jsp - What does "status" in <s:iterator> do? -
i using following command display values 'userlist'
<s:iterator value="userlist" status="rowstatus"> <tr class="even"> <td><s:property value="tweet_id" /></td> <td><s:property value="message" /></td> <td><s:property value="created" /></td> </tr> </s:iterator>
what use of status="rowstatus"
in command?
in case, none.
when iterating, current object pushed on top of value stack. means can access using name (along the many other ways).
you can use value wish value
attribute.
but if (in case different your, encounter soon) need put value in form field that submitted an(other) action, targeting list<yourobject>
attribute, need use iteratorstatus mount correct name
attribute. example:
sourceaction
private list<user> sourceuserlist;
targetaction
private list<user> updateduserlist;
jsp
<s:form action="targetaction"> <s:iterator value="sourceuserlist" status="rowstatus"> <s:hidden name="updateduserlist[%{#rowstatus.index}].id" value="id"/> <s:property value="id" /> <s:textfield name="updateduserlist[%{#rowstatus.index}].name" value="name" /> <s:textfield name="updateduserlist[%{#rowstatus.index}].age" value="age" /> </s:iterator> <s:submit/> </s:form>
got ?
Comments
Post a Comment