Struts2 label iterator loop property summation

 



 

<s:set var="total" value="0" /><!-- define a variable-->
  <s:iterator value = "{1, 2, 3, 4}" var="list" >
  ${list} +
  <s:set var ="total" value="#list+#total" /><!-- Sum the values ​​of list-->
  </s:iterator>
   <br>=
  <s:property value="#total"/> <!-- output the calculated value of total -->

https://zhidao.baidu.com/question/385729582.html


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326226145&siteId=291194637