tags:

views:

58

answers:

1

I have a very weird scenario in struts2.

When I do the following:

<s:property value="%{4/2}"/>

I get 2.

But when I do the following:

<s:property value="%{2/4}"/>

I get a big fat 0.

the property tag is always outputting an Integer even when the evaluated value is a double. How can I change this?

+3  A: 

You're doing integer arithmetic because your inputs are integers, not doubles: two divided by four is zero for integers. Try this:

<s:property value="%{2.0/4.0}"/>

instead.

RichieHindle
damn. that was a 'dumb' moment
Omnipresent