Home  >  Article  >  Web Front-end  >  Summary of common methods of struts2 tags

Summary of common methods of struts2 tags

一个新手
一个新手Original
2017-09-22 09:44:571262browse

1. Find whether there is a value equal to id in a list

<s:set name="flag" value="false" />
<s:iterator value="courses" id="item">
    <s:if test="${item==id}">
        <s:set name="flag" value="true" />
    </s:if>
</s:iterator>

2. Implement addition

Pure digital addition

<s:property value="1+2"/>
<s:property value="%{1+2}"/>

Addition with variables (the variables need to be Numeric type, if one of them is a string, it is string concatenation)

<s:property value="msgPK+msgPK"/>
<s:property value="%{msgPK+msgPK}"/>
<s:property value="#stat.index+1"/>

3. Get the subscript of iterator

<s:iterator value="prVoteQuestionAnswerList" id="class" status="num">
第<s:property value="#num.index+1"/>题
</s:iterator>

The above is the detailed content of Summary of common methods of struts2 tags. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn