I have a table that is dynamically created of multiple rows where each row needs a button that allows you to 'delete' - making a call to the server with an id (and another var in scope) being passed in the url. Currently it looks like this:
<c:forEach var="s" items="${actionBean.sampleResults}"> <tr> <td>${s.type}</td> <td>${s.name}</td> <td><input type="button" id="deleteButton" value="Delete" onclick="deleteSample('${actionBean.sampleMainTypeName}','${s.id}')"/> </td> </tr> </c:forEach> //script function deleteSample(sampleType, id) { location.href = "DeleteSample.action?sampleType="+sampleType+"&id="+ id } The above will be ok, but I'm wondering how others would use jquery to assign the button onclick handler when you happen to need some parameters that are part of an object in your collection your iterating over?