struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Sykes <a.sy...@ucl.ac.uk>
Subject Re: How to do matematical operation in jsp.
Date Wed, 22 Apr 2009 12:27:40 GMT
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.dave@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-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> -- 
> Stefano


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


Mime
View raw message