What do you mean by "argument type" exactly? An argument is part of a method signature, so are you referring to the setter/getter in an ActionForm? Or, as I suspect, you really mean the data type of the fields in your ActionForm (which of course *would* affect the argument type of the getter/setters, but I digress)...

My suggestion is to always use Strings only in your ActionForms as the data types for your fields (and hence the getter/setter argument types). The original intent of an ActionForm was to act as a communcation bridge between the incoming HTTP request and the Action (or view and control if you prefer). Since the view is typically a web interface, and since HTTP only knows how to deal with String parameters, it will ultimately make your life easier. Conversion to Java native types should happen when you get the data out of the ActionForm either via BeanUtils to your DTO (usually the better answer) or manually.

As Wendy points out, you *can* use native data types in an ActionForm, and I've done it myself too... Struts uses BeanUtils under the covers to populate the ActionForm anyway so you get those conversions "for free"... but, it's not considered a best practice to do so and it is tempting to use an ActionForm for more than it was intended, which leads to subtle problems sometimes. Better to avoid those issues altogether from the get-go.

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

Wendy Smoak wrote:
From: "Ankit Pancholi" <[EMAIL PROTECTED]>

Can you tell me the argument type for check box.
I tried Boolean considering it as on or off but it didn't work.


We're not going to be able to help without more information. When you say it didn't work... what happened? What does the Form bean look like, and how have you configured the action and form in struts-config.xml?

Try using String if Boolean isn't working well for you.





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

Reply via email to