Suppose we are iterating some list or map on jsp and we need to check key starts With some Sequence then we can do this using startsWith('someSequence') using OGNL.
Here is the code:
<s:iterator value="myMap">
<s:if test="%{key.startsWith('Hindi')}">
<tr>
<td><s:property value="%{key}"/></td>
<td><s:property value="%{value}"/></td>
</tr>
</s:if>
<s:else>
<tr>
<td><s:property value="%{key}"/></td>
<td><s:property value="%{value}"/></td>
</tr>
</s:else>
</s:iterator>
References: -
http://struts.apache.org/release/2.1.x/struts2-core/apidocs/org/apache/struts2/components/IteratorComponent.html
0 comments:
Post a Comment