struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kandi Potter" <Kandi.Pot...@PWGSC.GC.CA>
Subject RE: Can you send a "null" value to a form in Struts (1.1)?
Date Thu, 12 Jun 2003 15:40:21 GMT
I believe that, in general, parameters passed to the ActionForm from the jsp should be strings.
  You can edit for numeric in the validate() method.  Of course there are exceptions, boolean
for checkboxes for example.   

I'll state this and let someone correct me if I am wrong please.

-----Original Message-----
From: Joe @ Team345 []
Sent: Wednesday, June 11, 2003 9:45 PM
Subject: Can you send a "null" value to a form in Struts (1.1)?


Sorry if this is an oft asked question, but I just joined the list as I 
was unable to find the answer elsewhere.

I'm using StrutsRC 1.1 (with webdoclet/xdoclet going to jboss).  My 
question is basically in the subject: If I have a java Integer class on 
a form, can I send a null value to this from a jsp?  While I cannot find 
a way to do so, the logic in the "requiredif" part of the Validator 
makes me think that it should be possible.  [In case anyone doesn't know 
why I want to do this:  I have several fields (html:text elements) on a 
form that are optional - a common occurrence!  I'm trying to send a null 
for the Integer ones so that I know nothing was entered there.  However, 
whenever it runs I get a zero (0) instead.  This happens to be a legal 
value so I seem to be out of luck.

If this is not possible should all parameters passed (from a jsp) be 
Strings?  At least this way one can test for empty strings and take some 
action accordingly.

Looking forward to any thoughts or comments from others who have 
experienced this previously.

Joe Gamache

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

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

View raw message