user1047194
user1047194

Reputation:

Struts if evaluating a big decimal value of 0.0 as null

I have two big decimal fields x and y. If x is not null I would like to display x otherwise I would like to display y in a jsp. The struts if statement in my jsp say:

if (x != null){ display x} else { display y}

This is working as expected for null values of x and if x is a value other than zero but when x is set to zero it is displaying the y value.

Any help greatly appreciated.

Upvotes: 0

Views: 1290

Answers (1)

James Jithin
James Jithin

Reputation: 10565

I have tried this and this works as expected. When x is not null and with value 0.0, it displays 0.

        <s:if test="x != null">
            <s:property value="x"/>
        </s:if>
        <s:else>
            <s:property value="y"/>
        </s:else>

Upvotes: 1

Related Questions