簡體   English   中英

如何在struts 1中使用顯示標簽?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM