You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by markbeek <ma...@carolina.rr.com> on 2009/03/05 07:34:01 UTC

Re: Struts 2 Type conversion refuses 0.0 for a double?


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?

Thanks

-- 
View this message in context: http://www.nabble.com/Struts-2-Type-conversion-refuses-0.0-for-a-double--tp21738188p22345989.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 Type conversion refuses 0.0 for a double?

Posted by markbeek <ma...@carolina.rr.com>.

newton.dave wrote:
> 
> I believe it was probably what's conventionally known as a "mistake".
> It appears to have been resolved with XW-677.
> 

Yep, looks like that will take care of it. Thanks.
-- 
View this message in context: http://www.nabble.com/Struts-2-Type-conversion-refuses-0.0-for-a-double--tp21738188p22356671.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 Type conversion refuses 0.0 for a double?

Posted by Dave Newton <ne...@yahoo.com>.
markbeek wrote:
> 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?

I believe it was probably what's conventionally known as a "mistake".

It appears to have been resolved with XW-677.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org