struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markbeek <>
Subject Re: Struts 2 Type conversion refuses 0.0 for a double?
Date Thu, 05 Mar 2009 06:34:01 GMT

I have a Struts2 action with a double property called "amount". No
validation rules on the action as yet.

When I enter "0.0" into the amount on the JSP page, it displays an "Invalid
field value for field "amount"" error.

I've encountered the same behavior.

I've traced it to the isInRange method of an XWork class called
com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter. The isInRange
method returns false (ultimately causing an exception to be thrown) if the
double value is less than an infinitesimally tiny positive number. Since
zero is less than this number, it is not accepted as a legitimate value for
a double.

Can anyone (a) confirm this analysis of the source code, and (b) if so,
explain why the decision was made to consider zero an invalid entry for a
double property on a form field?


View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message