我的列表包含(“A”,“B”,“C”,“D”)元素
<s:iterator value="lis">
<s:property /><br>
</s:iterator>
和字符串str =“A”;
<s:property value="%{#request.str}"/>
我想将 list(lis) 的每个元素与 String 进行比较。
随着迭代器状态 http://struts.apache.org/release/2.3.x/struts2-core/apidocs/org/apache/struts2/views/jsp/IteratorStatus.html object:
<s:iterator value="lis" status="ctr">
<s:property />
<s:if test="%{#request.str.equals(lis[#ctr.index])}">
-> This value from "lis" is equal to the value of "str"
</s:if>
<br/>
</s:iterator>
随着var范围 http://struts.apache.org/release/2.3.x/docs/iterator.html:
<s:iterator value="lis" var="currentValue">
<s:property />
<s:if test="%{#request.str.equals(#currentValue)}">
-> This value from "lis" is equal to the value of "str"
</s:if>
<br/>
</s:iterator>
随着top
关键词:
<s:iterator value="lis">
<s:property />
<s:if test="%{#request.str.equals(top)}">
-> This value from "lis" is equal to the value of "str"
</s:if>
<br/>
</s:iterator>
You may wanna read the short OGNL Language Guide http://commons.apache.org/proper/commons-ognl/language-guide.html for more details.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)