<s:iterator value="MyList" status="idx">
<% int index = %><s:property value = '%{#idx.index}'/><% ; %>
</s:iterator>
The above code does not work. how can the integer value of the 'idx' be stored in the variable 'index'?
Instead of using java variables creating a struts variable works fine.
<s:set name="newVariable" value="%{#idx.index}" />
whenever you need to access the newly created struts variable. You can use this
<s:property value="#newVariable" />
you can access the list value in jsp using
<s:property value="dataname"/>
dataname is your pojo generated database columns
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.