You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by David Graham <dg...@hotmail.com> on 2003/02/26 06:34:56 UTC
Bug #17156 Validate Integer?
That bug states that validate required does not work with an ActionForm
property with type java.lang.Integer. Indeed, I tested this with the
struts-validator webapp's type form and required doesn't seem to run for
that field when I changed it from String to Integer. What does happen is
that a "0" shows up in the text box while the other fields remain blank and
their required error messages are displayed.
Is this simply a usage limitation of the validator? One more reason to use
Strings for all ActionForm properties? I'm guessing that 0 shows up because
that's the default value for an Integer object when it's created. I don't
know enough about this to close the bug as INVALID or fix it.
Thoughts?
Thanks,
Dave
_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org
Re: Bug #17156 Validate Integer?
Posted by Ted Husted <hu...@apache.org>.
Between 1.0 and 1.1 there's a switch that determines whether numerics
like Integer go to 0 or to null. If you have the test setup, try it
again with convertNull set to true as an ActionServlet parameter.
If it then works, we can just document the condition. Since numerics are
not recommended for ActionForms, we don't need to solution to be
particularly elegant =:0)
-Ted.
David Graham wrote:
> That bug states that validate required does not work with an ActionForm
> property with type java.lang.Integer. Indeed, I tested this with the
> struts-validator webapp's type form and required doesn't seem to run for
> that field when I changed it from String to Integer. What does happen
> is that a "0" shows up in the text box while the other fields remain
> blank and their required error messages are displayed.
>
> Is this simply a usage limitation of the validator? One more reason to
> use Strings for all ActionForm properties? I'm guessing that 0 shows up
> because that's the default value for an Integer object when it's
> created. I don't know enough about this to close the bug as INVALID or
> fix it.
>
> Thoughts?
>
> Thanks,
> Dave
>
>
>
>
>
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
>
--
Ted Husted,
Struts in Action <http://husted.com/struts/book.html>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org