简体   繁体   English

从 jstl foreach 调用 Javascript function

[英]Call a Javascript function from jstl foreach

I am iterating over a list in JSTL to show its records.我正在遍历 JSTL 中的列表以显示其记录。 There is onclick="editList()" event on each <form:label .每个<form:label上都有onclick="editList()"事件。 I want to send both ${item.id} and ${item.number} in the editList() function parameters if any of them is clicked.如果单击其中的任何一个,我想在editList() function 参数中发送${item.id}${item.number} How can I send these parameters.我怎样才能发送这些参数。

<c:forEach var='item' items='${rule.list}' varStatus="itemsRow">
 <tr>
    <form:label path="list[${itemsRow.index}].id" onclick="editList()">
     ${item.id}
    </form:label>
 </tr>
 <tr>
    <form:label path="list[${itemsRow.index}].number" onclick="editList()">
     ${item.number}
    </form:label>
 </tr>
</c:forEach>
onclick="editList('${item.id}', '${item.number}')"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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