In my Struts 2 app I needed to check for an enum value in the jsp. Using the struts <s:if test=”"> tag this can be done :
<s:if test=’#role.toString()!=”PAID”‘></s:if>
Hope this helps out someone. What I’m doing is getting the string representation of the enum and comparing the same. I did not know we could do a toString() here, hence thought of blogging about it!
Tags: enum compare struts, struts, struts 2 enum, struts enum