Search code examples
jspstruts2

How to send row values when checkbox is clicked to struts action class


Here i need to send only checked values to struts action class. if i check 1st row check box then i need to send only 1row values to action class or 4th then 4th row values

<s:iterator value="stafflistfirsttime">
    <tr >
                                                            <td>second<s:checkbox name="ckeckbox"cssClass="case chkPassport"fieldValue="%{ReferenceID}" /></td>
<td class="t" ><s:property value="ReferenceID" /></td>
<td class="stfnm"><input type='hidden' name="Name" 
value=<s:propertyvalue="teacherFirstName" />" />    
<s:property value="teacherFirstName" /></td>                                                            
<td class="bb"> <s:textfield name="Basics"                                                                  cssClass="form-control expenses" value="" size="6" /></td>
<td class="allw"><div class="form-group">
<div class="col-xs-1"><s:textfield name="Allowances" cssClass="form-control expenses" value="" size="6" /></div></div></td>

Solution

  • Replace your existing tag with ordinary html

    <checkbox name="ckeckbox"class="case chkPassport"value="${ReferenceID}" />
    

    The ReferenceID should be accessible from the valueStack because of struts request wrapper.