On Tue, 14 May 2002, Galbreath, Mark wrote:
> Date: Tue, 14 May 2002 12:12:51 -0400
> From: "Galbreath, Mark" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: "Struts (E-mail)" <[EMAIL PROTECTED]>
> Subject: <html:text> issue
>
> Is there a way to suppress the default value for <html:text> when the
> property of the bean is an int? I don't want a "0" showing in the textbox
> when the property has not been set - it's screwing up validation.
>
The canonical answer is "don't do that".
The design intent of Struts is that you use a String property in your form
bean for values that ultimately need to be integers (or, basically, any
other data type where a conversion is required, and the conversion might
fail due to incorrect input). The primary purpose for this is so that a
user who types in "1a3" can receive an intelligent error message back
again, *and* see the "1a3" bad input in the text field so that they can
fix it. This is a fundamental user expectation that well designed webapps
should support.
A side effect of making this form bean property into a String is that you
can initialize it to "" or null, and avoid the "0" being displayed.
> Thanks,
> Mark
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>