We do this by wrapping the int value in a getWhateverDisplay method that
returns a string - we test if the int value is 0 then return an empty string
- the form field then refers to the whateverDisplay attribute.  The set
method (setWhateverDisplay) then converts the entered value back to the int.

Les.

-----Original Message-----
From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
Sent: 14 May 2002 17:55
To: 'Struts Users Mailing List'
Subject: RE: <html:text> issue


Right, the problem is Java initializes numeric primitives to "0" so "0" is
being passed when what I need is a blank textbox (like an empty String) so I
can validate that the user has actually input a value - even if it's "0."  I
haven't tried it, but wrapping the int with Integer would pass the same
value, no?

Basically, what I'm wondering is why <html:text> does not have a "format"
attribute like <bean:write>?

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 12:30 PM

Shouldn't this be taken care of in the bean? Why "fix" it in the jsp?

That is, the bean should provide valid display values.

If it shows 0, "when the property has not been set" then can the bean have
the appropriate values initialized?

This approach simplifies the jsp's and makes it less painful for the
jsp/struts tag users.

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

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

Reply via email to