Put %{}
around the whole expression, not in the middle as in other attributes of other tags:
Also use a more appropriate equality function for Strings, like described here
<s:if test='%{elements[#element.index].status.equalsIgnoreCase("Student") ||
elements[#element.index].status.equalsIgnoreCase("Teacher")}'>
EDIT: dude, you are doing a lot of odd things;
${Status}
is JSP EL, you have no need of using it;- You are iterating a source, and checking another source: printing
<s:property value="elements[%{#element.index}].Status" />
gives you an empty result, and I can't see thatelements
thing anywhere in your code; - the capital letter as first in an attribute is WRONG, because if the variable is named
foo
and the getter isgetFoo()
, in page you will have.foo
, not.Foo
. If your variable is namedFoo
, it is against the specs / best practices, let's start variables names with a lowercase letter.
Then If you have private Object Status
, change it to private Object status;
, along with the getter and the setter, and in page use:
<s:iterator value="listOfPeople" status="element">
<s:if test='%{listOfPeople[#element.index].status.equalsIgnoreCase("Student") ||
listOfPeople[#element.index].status.equalsIgnoreCase("Teacher")}'>
or with a var
<s:iterator value="listOfPeople" status="element" var="row">
<s:if test='%{row.status.equalsIgnoreCase("Student") ||
row.status.equalsIgnoreCase("Teacher")}'>
or simply
<s:iterator value="listOfPeople" status="element">
<s:if test='%{status.equalsIgnoreCase("Student") ||
status.equalsIgnoreCase("Teacher")}'>
Strange code leads to weird results... then use it straight :)