Wednesday, May 23, 2012

Struts2 - How to create a <s:form> for each row in <display:table>

I was trying to show a displaytag table and I wish to map each row on a different s:form.
Each row show all the attributes of my System object and I wish to choose one row and act on the related object.
I tryed to put multiple display:column in one form, but when I load the JSP, I don't find any form tag.



Any suggestion?



My code:



<display:table name="${systemList}" uid="row" pagesize="20" sort="list" requestURI="" >

<display:column title="System ID" property="systemID" sortable="true" />

... other columns ...

<s:form action="provision.action" method="post" name="provisionForm%{#attr.row.systemID}">

<display:column title="IP" >
<s:textfield name="systemList[%{#attr.row_rowNum - 1}].ip" />
</display:column>

<display:column>
<s:submit type="image" src='image.png' name='submit' />
</display:column>
</s:form>

</display:table>


Thanks in advance





No comments:

Post a Comment