Re: Search list

2002-12-16 Thread Ryan Olson
Try this

http://www.mail-archive.com/struts-user@jakarta.apache.org/

Ryan Olson


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Testing an action

2002-12-11 Thread Ryan Olson
Alireza,

I highly recommend StrutsTestCase, which makes use of JUnit and the Jakarta 
Cactus framework:

http://strutstestcase.sourceforge.net

- rdo


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Confused about log4j error message

2002-12-06 Thread Ryan Olson
Hi,

My apologies if this is a FAQ, but I haven't turned up anything on Google and 
it looks like the mailing list archive search is broken (keeps saying "Text 
search is not available for this list").

I'm using Struts 1.1b and Tomcat 4.0.4. The first thing on stdout when I start 
up my struts application is

log4j:WARN No appenders could be found for logger 
(org.apache.struts.util.PropertyMessageResources).
log4j:WARN Please initialize the log4j system properly.

Now, I've read lots of documentation and book chapters on using log4j and I 
can't figure out what I'm doing wrong. I've got a commons-logging.properties 
file with the entry org.apache.commons.logging.Log= 
org.apache.commons.logging.impl.Log4JCategoryLog. I've got a log4j.properties 
file in WEB-INF/classes copied from the simple configuration in Chuck 
Cavaness' Struts book, which is supposed to direct everything to the console:

log4j.rootlogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

I have the log4j and commons-logging jars in my WEB-INF/lib directory.

What happens is that I get the warnings described above, and none of my log 
messages, created with log.error(), are visible. I'm 99% sure that my use of 
commons-logging is not the problem, since I do see log messages when I use 
the JDK 1.4 logging instead.

Any ideas? Thanks

Ryan Olson


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: [slightly OT] Time zone strategies

2002-12-02 Thread Ryan Olson
Well, that's the approach I'd taken originally, but I found two problems with 
it:

1) I didn't like how that approach mixes the presentation layer into the 
business layer (ie, my data access objects shouldn't care what timezone the 
user is in)

2) I don't necessarily know ahead of time (ie, when fetching the data) what 
timezone the user is in

What I'm aiming for is a solution that does all the timezone manipulation on 
the presentation/view layer so that my business objects don't have to worry 
about it. At least, I think that's what would make the most sense...

Thanks

Ryan Olson

"Hajratwala, Nayan (N.)" <[EMAIL PROTECTED]> wrote:
> I didn't delve too much into the details of your current approach, but 
> couldn't you do this fairly easily using the Calendar class...


>   Date fromDb = ResultSet.getDate(...);
>   Calendar cal = Calendar.getInstance(user's TimeZone, optionally user's 
> Locale);
>   cal.setTime(fromDb);

>   Now you can manipulate/display the values in the user's timezone

Original Message-
From: Ryan Olson [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 02, 2002 2:23 PM
To: Struts Users Mailing List
Subject: [slightly OT] Time zone strategies


Hi all,

Although this problem isn't necessarily unique to struts, it's certainly 
something that many of you may have come across in building struts 
applications. I'm writing a CRUD-type app to manage news articles which will 
support users in various time zones. Individual articles have date/time 
stamps which are normalized to the server reference timezone as they are 
stored in the model layer. However, each user should see and modify the dates 
in his/her own timezone on the presentation layer, optionally specifying 
alternate timezones if desired.
[...]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Bypassing validation in ActionForm for certain LookupDispatchAction modes

2002-12-02 Thread Ryan Olson
Hi,

I have a LookupDispatchAction which performs add, update, and delete 
operations based on an incoming ActionForm. I have a validate() method in the 
ActionForm since I need to validate input for the update and add operations, 
but I want to bypass that method in the case of the delete action (ie I don't 
want the user to be stopped from deleting a record that they may have made 
changes to and doesn't presently contain valid data).

Based on the list archives it looks like the way to do this is to add a check 
to the validate() method, like this:

String dispatchParam = mapping.getParameter();
String dispatchActionMode = request.getParameter(dispatchParam);

Since I'm using LookupDispatchAction I want to compare the value of 
dispatchActionMode with the button label as defined in my 
ApplicationResources properties file ("button.label.delete") in this case. 
However, I haven't been able to figure out how to get at that value from 
within my ActionForm. (Actually, I'd rather look up the value in the Map 
returned by getKeyMethodMap() in the LookupDispatchAction, but it's neither 
public nor static.) 

I'm also open to other suggestions as to how to go about doing this.

Thanks

Ryan Olson


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




[slightly OT] Time zone strategies

2002-12-02 Thread Ryan Olson
Hi all,

Although this problem isn't necessarily unique to struts, it's certainly 
something that many of you may have come across in building struts 
applications. I'm writing a CRUD-type app to manage news articles which will 
support users in various time zones. Individual articles have date/time 
stamps which are normalized to the server reference timezone as they are 
stored in the model layer. However, each user should see and modify the dates 
in his/her own timezone on the presentation layer, optionally specifying 
alternate timezones if desired.

My current approach is the following (bear with me):

- business layer object ArticleBO contains a Date field populated from db with 
ResultSet.getDate()
- view layer ActionForm ArticleForm contains a Date object (internalDate) as 
well as String fields for date and time; internalDate is prepopulated from 
ArticleBO for view/edit actions
- Article JSP contains two text fields for date and time strings, which are 
not themselves prepopulated from the ArticleForm, but rather filled in as the 
page loads via JavaScripts which use internalDate.getTime() to create a 
localized JavaScript Date object and corresponding date/time strings for the 
form
- ArticleForm also contains a hidden field clientTimezoneOffset that is 
populated by JavaScript as (new Date()).getTimezoneOffset(), which is the 
client's GMT offset in minutes
- ArticleForm returns to my add/edit/whatever Action after validation, at 
which point the date/time strings are converted back to a Date object using a 
SimpleDateFormat. The SimpleDateFormat is set to the client's timezone using 
the offset information in the clientTimezoneOffset field. This is tricky 
because 
1. JavaScript-supplied values are the negative of what Java expects -- for 
example, California comes out as +8 (+7 DST) instead of -0800 (-0700 DST)
2. Since the offset value is adjusted for DST according to the local time on 
the client, the retrieval method must un-adjust it accordingly when setting 
the raw offset of the resulting TimeZone (which is DST-neutral)
- ArticleBO populated from ArticleForm now holds a Date object in the server's 
timezone

It took me awhile to figure that all out, and it seems to work well based on 
the testing I've done by setting the test lab machines' clocks/timezones 
every which way. It's an awfully convoluted process, though, and I don't like 
to rely on JavaScript. 

Has anyone else come up with a better solution? 

Thanks

Ryan Olson


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




LookupDispatchAction and unspecified method

2002-11-25 Thread Ryan Olson
Hi,

I recently started using Struts after having done it the hard way in several 
past applications. Great stuff.

I've searched the list archives on this but haven't really come up with a 
satisfactory answer. Basically I'm wondering about the functionality of the 
unspecified(...) method in LookupDispatchAction, as inherited from 
DispatchAction. The javadocs on this method indicate that it is what gets 
called in the event that there is no value for the request param that 
control's the action's behavior. Since I've got an  tag in my 
form, I was expecting the unspecified(...) method of the target 
LookupDispatchAction to get called when the cancel button gets pressed, but 
instead I'm getting an exception indicating that the request param is 
missing. I tried specifying the "parameter" attribute of the html:cancel tag, 
but that left me with a NullPointerException, and besides, that wouldn't seem 
like the proper solution since as the docs point out, using that attribute 
breaks the Action.isCancelled() method.

I've seen a couple people post the solution of overriding 
LookupDispatchAction.execute(), which makes sense, but it seems like there 
ought to be a cleaner solution (via the unspecified(...) method, I should 
think).

Am I going about this all wrong?

Thanks

Ryan Olson
www.financialcontent.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>