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

2009-01-30 Thread san-ho-zay

Thanks for your reply Lukasz. In practice, I should use BigDecimal to avoid
rounding problems but it doesn't change the fact that 0.0 shouldn't be
thrown up as an invalid conversion for a double.

This works perfectly well, so I can't understand why Struts2 throws 0.0
out as an error ...

public class Test {

public static void main(String[] args) {
double d = Double.parseDouble(0.0);
System.out.println(d);
}

}

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


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



Struts 2 Type conversion refuses 0.0 for a double?

2009-01-29 Thread san-ho-zay

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.

If I blank the amount it gets through the conversion and 0.0 gets stored in
the database. Fair enough because it's a double. If I enter things like 12,
12.3, 12.34, etc. they pass validation OK. But it won't accept 0.0 or 0.

Struts 2.1.6. Default interceptors. Using the Tiles and Spring plugins. JSPs
and XHTML theme. All pretty standard stuff.

I've searched but nobody else seems to have anything like this issue. Any
ideas?

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


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