Abstract the HashMap behind another class that has a getTotal(Item key) method, and do the math in there (return item.prize * quantity).

Doing any math in the JSP feels dirty.

On 22 Apr 2009, at 13:16, Stefano Tranquillini wrote:

Because the items are stored in hashmap <Item, Quantity> item contains the
prize.
so, to know the total for each item i've to multplay item.prize with
quantity.

no more else.



On Wed, Apr 22, 2009 at 14:01, Dave Newton <newton.d...@yahoo.com> wrote:

Stefano Tranquillini wrote:

but i've only to display in a jsp the results, when i use that value i
compute it by the ejb.


Then why are you re-computing it in the JSP?

The point is only that floating-point math is inaccurate. If you don't
care, or are controlling the results of the math somehow, then fine.


Dave


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




--
Stefano


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

Reply via email to