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
contains the
p
Because the items are stored in hashmap 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 wrote:
> Stefano Tranquillini wrote:
>
>> but i've only to display in a jsp the results, wh
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 someho
but i've only to display in a jsp the results, when i use that value i
compute it by the ejb.
On Tue, Apr 21, 2009 at 22:51, Dave Newton wrote:
> Stefano Tranquillini wrote:
>
>> The right solution is to calculate and insert in a new bean the elements
>> and
>> its total value?
>>
>
> That's *a*
Stefano Tranquillini wrote:
The right solution is to calculate and insert in a new bean the elements and
its total value?
That's *a* right solution, yes, particularly since you're doing money
math. For money math to produce consistent, correct results you usually
need to define a precision an
The right solution is to calculate and insert in a new bean the elements and
its total value?
On Tue, Apr 21, 2009 at 20:29, wrote:
> Nice reference Wes! BTW, I noticed you are not using the new cover letter
> for the TPS reports, so I'm going to have to go ahead and ask you to read
> that memo
Nice reference Wes! BTW, I noticed you are not using the new cover letter
for the TPS reports, so I'm going to have to go ahead and ask you to read
that memo one more time.
Peace,
the Bob's
On Tue, Apr 21, 2009 at 11:11 AM, Wes Wannemacher wrote:
> [snip]
> >
> > OTOH, siphoning the $.
Lukasz Lenart wrote:
2009/4/21 Dave Newton :
And the next step will be implement whole bank security in jsp :P
Right, because that's clearly the type of "trivial functionality" I was
talking about. Don't be ridiculous.
Young programmers very often follow such advices and extend logic in
jsp
works!
On Tue, Apr 21, 2009 at 18:56, Lukasz Lenart
wrote:
> 2009/4/21 Dave Newton :
> >>> And the next step will be implement whole bank security in jsp :P
>
> > Right, because that's clearly the type of "trivial functionality" I was
> > talking about. Don't be ridiculous.
>
> Young programmer
2009/4/21 Dave Newton :
>>> And the next step will be implement whole bank security in jsp :P
> Right, because that's clearly the type of "trivial functionality" I was
> talking about. Don't be ridiculous.
Young programmers very often follow such advices and extend logic in
jsp, they have a probl
mitch gorman wrote:
Lukasz Lenart wrote:
And the next step will be implement whole bank security in jsp :P
...
Right, because that's clearly the type of "trivial functionality" I was
talking about. Don't be ridiculous.
Don't teach people such a things, jsp is only for presentation! What
w
Lukasz Lenart wrote:
> 2009/4/21 Dave Newton :
>
>>> How do you want to test it? I know it's a simple case, but it's better
>>> to have logic in one place.
>>>
>> As I said, I'm easily convinced in this particular case.
>>
>> OTOH, there are plenty of times when it's simply easier, quicke
2009/4/21 Dave Newton :
>> How do you want to test it? I know it's a simple case, but it's better
>> to have logic in one place.
>
> As I said, I'm easily convinced in this particular case.
>
> OTOH, there are plenty of times when it's simply easier, quicker, and
> clearer to just implement trivial
and remember, STAY AWAY FROM THE PATH OF EEVILLE!
Jim Kiley wrote:
> EVIL, wow, sounds serious.
>
> On Tue, Apr 21, 2009 at 12:02 PM, Lukasz Lenart <
> lukasz.len...@googlemail.com> wrote:
>
>
>> 2009/4/21 Suneel :
>>
>>> I'm not sure about this but can't you invoke a function in
Jim Kiley wrote:
RoundingMode.SUPERMAN_III
I've caffeinated my nose.
Dave
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
[snip]
>
> OTOH, siphoning the $.0039079850466805510222911834716796875 into
> offshore accounts will eventually make you rich.
>
> Dave "Expecting his 10% cut" Newton
>
[/snip]
But, you have to be careful when moving the money into your own account...
[quote]
We're not just talking ab
RoundingMode.SUPERMAN_III
On Tue, Apr 21, 2009 at 12:07 PM, Dave Newton wrote:
> Dave Newton wrote:
>
>> The issue for me would be that if this is money maths it should be using
>> BigDecimal (or something), and I'm not sure what OGNL would do with the '*'
>> operator.
>>
>
> It would multiply th
Lukasz Lenart wrote:
2009/4/21 Dave Newton :
Meh--for simple stuff like this I'm not as sure, although if we're talking
about a line item in a invoice, it wouldn't take much to convince me.
How do you want to test it? I know it's a simple case, but it's better
to have logic in one place.
As
Jim Kiley wrote:
EVIL, wow, sounds serious.
I just tested BigDecimal math in JSP/OGNL and the room started smelling
like sulfur.
Sure, it could have been the huevos rancheros, but I'm pretty sure it
was the math in the JSP.
Dave
--
Dave Newton wrote:
The issue for me would be that if this is money maths it should be using
BigDecimal (or something), and I'm not sure what OGNL would do with the
'*' operator.
It would multiply the BigDecimals, but using a default MathContext,
which may or may not give the results you reall
EVIL, wow, sounds serious.
On Tue, Apr 21, 2009 at 12:02 PM, Lukasz Lenart <
lukasz.len...@googlemail.com> wrote:
> 2009/4/21 Suneel :
> > I'm not sure about this but can't you invoke a function in OGNL. I
> > guess thats how the getText function works in ognl. Probably you can
> > write a functi
2009/4/21 Suneel :
> I'm not sure about this but can't you invoke a function in OGNL. I
> guess thats how the getText function works in ognl. Probably you can
> write a function in your action like getResult and invoke it using
>
> Correct me if i'm wrong.
Yes you can do that, but it's EVIL! DON'
2009/4/21 Dave Newton :
> Meh--for simple stuff like this I'm not as sure, although if we're talking
> about a line item in a invoice, it wouldn't take much to convince me.
How do you want to test it? I know it's a simple case, but it's better
to have logic in one place.
> The issue for me would
I'm not sure about this but can't you invoke a function in OGNL. I
guess thats how the getText function works in ognl. Probably you can
write a function in your action like getResult and invoke it using
Correct me if i'm wrong.
On Tue, Apr 21, 2009 at 10:34 AM, Stefano Tranquillini
wrote:
> Hi
Lukasz Lenart wrote:
2009/4/21 Stefano Tranquillini :
how can i do that?
Add method to class Item to do that, jsp isn't place for business logic
Meh--for simple stuff like this I'm not as sure, although if we're
talking about a line item in a invoice, it wouldn't take much to
convince me.
Stefano Tranquillini wrote:
and a value calculated at runtime that is a moltiplication of:
and
how can i do that?
Does not work?
Dave
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands,
2009/4/21 Stefano Tranquillini :
> how can i do that?
Add method to class Item to do that, jsp isn't place for business logic
Regards
--
Lukasz
http://www.lenart.org.pl/
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache
Hi all
i've a hashmap that contains object and a value(int).
i would display all the value of the object:
x
and a value calculated at runtime that is a moltiplication of:
and
how can i do that?
thanks
--
Stefano
28 matches
Mail list logo