For actionforms you should make them all strings. Certainly anything that
allows for text entry in the UI should be made a string even if it is
intended for numeric input. (For checkboxes and such like its less important
though Id still recommend using strings for them)

This allows you to return the user to the form when validation fails with
the input they entered preserved - so if they type "One" instead of "1" the
bad value will be preserved for them to correct on return to the page.

If they type text into a field whose actionform property is numeric you can
have problems handling it. I cant remember if it causes an exception or is
just converted implicitly to the value 0 - but either way its a problem...

-----Original Message-----
From: Xuemin Guan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 24 March 2004 11:30
To: Struts Users Mailing List
Subject: Form's property, String or not?


Hi, dear all, very new to Struts. Just a simple question:

As a best practice of Struts,  should I declare formebeans'
properties all as String, or the "actual" type (such as BigDecimal,
int, float, and double etc.)

Thanks,

Xuemin


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



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

Reply via email to