Home >Web Front-end >JS Tutorial >Summary of common methods of struts2 tags
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!