Home » » How To Check Key Of Iterator Starts With ( using startsWith('') ) Some Sequence In Jsp Using Struts 2?

How To Check Key Of Iterator Starts With ( using startsWith('') ) Some Sequence In Jsp Using Struts 2?

Rendyon | 2:02 AM | 0 comments
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
Share this article :

0 comments:

 
Copyright © 2011. Find Updates - All Rights Reserved
Template Modify by Creating Website
Proudly powered by Blogger