Compare Long values Struts2

Posted by Marquinio on Stack Overflow See other posts from Stack Overflow or by Marquinio
Published on 2010-03-18T15:39:42Z Indexed on 2010/03/18 15:41 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

Hi everyone I'm trying to compare two values using struts2 s:if tag but its not working. If I hardcode the values it works but I want it to be dynamic.

The variable stringValue is of type String. The variable currentLongValue is of type Long.

<s:set var="stringValue" value="order"/>
<s:iterator value="listTest">
 <s:set var="currentLongValue" value="value"/>

 <s:if test="#currentLongValue.toString() == #stringValue" >
   //Do something      
 </s:if>
 <s:else>
 //Do something else
 </s:else>

</s:iterator>

For the s:if I have tried toString and also the equals(). It only works if I hardcode the values. Example:

<s:if test="#currentLongValue == 1234">

Any clues?

Thank you.

© Stack Overflow or respective owner

Related posts about struts2

Related posts about jsp