On 12-10-2010 at 17:27, Daniil Sosonkin wrote:
> <body bgcolor="#ffffff" text="#000000">
> <font size="-1"><font face="Tahoma">To all, not even sure this is a
> bug or am I doing something wrong, but I just can get the value
> selected properly. The code fragment is as follows:<br>
> <br>
> <s:select class="fields" name="strike" value="${strike}"><br>
> <s:options-collection collection="${strikes}"/><br>
> </s:select><br>
> <br>
> The form submits to an action bean that has getters and setters
> for the "private double strike".<br>
Not sure if it helps, but doubles and floats are infamous for this kind of
thing. The select tag does an equality comparison, and floats and especially
doubles are a little imprecise so that fails. This is also why an equality
test on a float/double is taught as "Math.abd(d1-d2) < 0.00000000001" or
similar instead of "d1 == d2" / "d1.equals(d2)".
In your situation, I'd convert the monetary value of the option's strike
price to a fixed point number (using a BigDecimal with a scale of 2, 3 or
maybe 5) or even an integer number (the BigDecimal multiplied by 100, 1000 or
100000).
Oscar
--
,-_ Oscar Westra van Holthe - Kind http://oscar.westravanholthe.nl/
/() )
(__ ( Simplicity is prerequisite for reliability.
=/ () -- Edsger Dijkstra, EWD498
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users