Reputation: 427
I have been looking for use <s:property>
in struts2 if condtion...and I found the solution but Contains
or IndexOf
doesn't works in my case can someone help me on syntax....
<s:iterator value="DirList" status="DirSTS" var="Dir">
<s:if test="#DetailsStatus.index==#DirSTS.index">
<s:if test="%{#Dir.indexOf(':'}!= -1">
<a href='<s:property/>'><small>Click Here </small></a>
</s:if>
</s:if>
</s:iterator>
Here DetailsStatus is main list status variable...here I want to check if <s:property>
have :
symbol
Upvotes: 1
Views: 2331
Reputation: 673
First thing that your syntax missing ) closing bracket. Second make sure you have correct values in list which have : Symbol(You have already commented that it have wrong values)
here is your code
<s:iterator value="DirList" status="DirSTS" var="Dir">
<s:if test="#DetailsStatus.index==#DirSTS.index">
<s:if test="%{#Dir.indexOf(':'}!= -1">
<a href='<s:property/>'><small>Click Here </small></a>
</s:if>
</s:if>
change your code to like this....
<s:iterator value="DirList" status="DirSTS" var="Dir">
<s:if test="#DetailsStatus.index==#DirSTS.index">
<s:if test="#Dir.indexOf(':')!= -1">
<a href='<s:property/>'><small>Click Here </small></a>
</s:if>
</s:if>
Upvotes: 3