[英]How to use display tag with struts 1?
我想要单击删除按钮时,我将获得CustomerID
并发送给Action。 执行功能删除。
<display:table name="sessionScope.CustomerForm.customers" id="row"
requestURI="/Customer.do" pagesize="15" style="text-align:center"
excludedParams="_chk" clearStatus="true">
<display:column title="checkkbox">
<input type="checkbox" onclick="selectCheckbox();" id="checkBox" />
</display:column>
<display:column style="width:500px" property="customerID"
title="Customer ID" sortable="true" paramId="customerID"
href="Edit.do">
</display:column>
<display:column style="width:300px" property="customerName"
title="Customer Name" sortable="true" />
<display:column style="width:300px" property="sex" title="Sex"
sortable="true" />
<display:column style="width:300px" property="birthday"
title="Birthday" sortable="true" />
<display:column style="width:300px" property="email" title="Email"
sortable="true" />
<display:column style="width:300px" property="address"
title="Address" sortable="true" />
</display:table>
</div>
<br>
<div>
<html:button styleClass="submit" property="Add new" value="Add New"></html:button>
<html:button styleClass="submit" property="Delete" value="Delete" ></html:button>
</div>
</html:form>
将customerID参数传递给您的js函数,如下所示:
<display:column title="checkkbox">
<input type="checkbox" onclick="selectCheckbox(<bean:write value="customerID" />);" id="checkBox" />
</display:column>
要么
this
传递给您的js函数,然后使用js或jQuery浏览html代码,例如,您可以使用以下代码:
function selectCheckbox(element){
var customerID = $(element).parent().children("td")[1].html();
// do your stuff!
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.