Reputation: 95
<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'?
Upvotes: 1
Views: 4165
Reputation: 95
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" />
Upvotes: 1
Reputation: 95
you can access the list value in jsp using
<s:property value="dataname"/>
dataname is your pojo generated database columns
Upvotes: 0