You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Craig Tataryn <ne...@computer-programmer.org> on 2004/03/13 23:57:20 UTC

"" does not mean 0 [in my app] :)

Hi there, is there a configuration setting for Struts which tells it to set a property on a form
bean of type "Integer" (not int) to null instead of "new Integer(0)" when the corresponding value
coming in from the user's form is an empty string?

I had to create a plugin that had the following in it's init() method:

ConvertUtils.register(new IntegerConverter(null),Integer.class);

Thanks,

Craig.
<tataryn:craig/>

<tataryn:craig/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: "" does not mean 0 [in my app] :)

Posted by Hubert Rabago <ja...@yahoo.com>.
That's the expected behavior.  At the bottom of
http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna_action_form_classes:

"And, of course, while the DynaActionForm may support various binary types,
properties used with the html:text tag should still be String properties."

Hubert

--- Craig Tataryn <ne...@computer-programmer.org> wrote:
> Hi there, is there a configuration setting for Struts which tells it to set
> a property on a form
> bean of type "Integer" (not int) to null instead of "new Integer(0)" when
> the corresponding value
> coming in from the user's form is an empty string?
> 
> I had to create a plugin that had the following in it's init() method:
> 
> ConvertUtils.register(new IntegerConverter(null),Integer.class);
> 
> Thanks,
> 
> Craig.
> <tataryn:craig/>
> 
> <tataryn:craig/>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org