tags:

views:

25

answers:

1

Hello,

i'm trying to compare a value to an Enum in Struts:

<s:if test="%{myValue == com.app.core.Values.ALL}" />

where myValue is declared in the Action and com.app.core.Values is declared in another project that is referenced to this one.

Any tips?

Thanks

+3  A: 

See Accessing static properties in the Struts documentation.

I think what you need is:

<s:if test="myValue == @com.app.core.Values@ALL">

You may also need to set the struts configuration constant struts.ognl.allowStaticMethodAccess to true.

Todd Owen
+1 Sometimes it's more clean to define a method in your action that does the comparison
leonbloy