Hello all,
I have a Struts 2 jsp with the following code...
<s:iterator value="categories" id="category" status="iteratorStatus">
<s:if test='#category == "M" '> snip </s:if>
The problem is the java code behind categories is..
private static final CategoryEnum[] PRIVATE_VALUES = {A,B,C,M };
public static final List<CategoryEnum> VALUES = Collections.unmodifiableList(Arrays.asList(PRIVATE_VALUES));
public List<CategoryEnum> getCategories() {
return CategoryEnum.VALUES;
}
So the IF statement does not work, it never evalutes to true. I've tried escaping the charaters etc, but with no success.
I'd prefer to make a call back to the Action class with the 'category' value and have that decied what to do. e.g.
<s:if test='renderCategory(#category)> snip </s:if>
but I don't know how to pass the #category back to the action.
So can anyone help either me work out how to pass the value back or to make the Struts IF tag work with an enum.
I've already read this: which isn't much help here, but I'll reference iy anyway:
Struts 2: Why won't the 'if' tag evaluate a one char string
can anyone help me please?
Jeff Porter