简体   繁体   中英

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 ComputerSystem 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 in the generated source code.

(I have to use s:form because one of my columns contains as:doubleselect)

Any suggestion?

My code:

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

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

            ... 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

您可以在装饰器内部生成代码,获取行对象属性,然后在displaytag内使用装饰器。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM