> 1) What is the best practice for the properties in an 
> ActionForm bean? 
> Because HTTP sends everything from forms as strings, do I make all 
> properties Strings, then convert them in the Action (after 
> validating of course)?

Yes. The documentation suggests that all form properties be Strings, as do most of the 
texts I have. However, I have used other data types in the past (specifically Integer 
and the other wrapper types) without any trouble, although it's more tedious to do so. 
YMMV, and again it's not what is recommended by the platform authors.
 
> 2) I am using a mySQL DateTime column in the database. What 
> is the best practice for editing these values via Struts? Do I 
> put a java.util.Date proeprty in the Action form? Or do I use a 
> String (as in Q #1) and then do a conversion in the Action?

Now here is a case where you really do want to make sure you pass in everything as 
Strings. When dealing with date objects I typically pass in separate date elements 
(month, year, hour, etc.) as various form elements, then munge them when they reach 
the Action or the ActionForm. Dealing with Dates directly is cumbersome, to say the 
least.

This isn't even a Struts issue, really. I had to do the same thing in ASP and PHP. 
Dealing with SQL data types via HTTP's text-only request data is sometimes a pain in 
the ass. There are a ton of ways to deal with this; search Google for more into.

-= J

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

Reply via email to