java - Retrieve multiple checkbox values from jsp in the spring controller class -


in table, i've row checkbox tells controller whether particular row of table has included or no. check box not have relation other rows. tried adding in following way :

<form:form id="fee" method="post" modelattribute="clientform" commandname = "clientform"  action="<%= request.getcontextpath().tostring()%>/addfee.do">      <table>             <tr>                 <c:foreach var="type" items="${clientinfo}" varstatus="status">                     <td><form:checkbox class="editable${ifeecount}" path="includefeevalue" value="false"/> </td>                         <td>feetype<c:out value = "${status.index}"/></td>                         <td>source fee<c:out value = "${status.index}"/></td>                         <td><form:input class="editable${ifeecount}" disabled="true" path="overriddenfee" /></td>                             <td><form:errors path="overriddenfee" cssclass="error" /></td>                 </c:foreach>             </tr>     </table> 

and in form, i've list private arraylist<string> includefeevalue;

and i'm trying retrieve in spring controller class follows :

@requestmapping(value="/addfee.do",method = requestmethod.post) protected @responsebody modelandview selectvalues(@modelattribute("clientform") paswfeemaintenanceform mymaintform ) throws exception {      for(int i=0;i<mymaintform.getincludefeevalue().size();i++){         system.out.println("checkbox : "+mymaintform.getincludefeevalue().get(i)+ " of "+i);     } } 

once submit form, throws null pointer exception in here : mymaintform.getincludefeevalue().size() .

could tell me what's missing here?

remove disabled='true' , work. faced same problem textfield property disabled true.

and use private string[] includefeevalue instead of list.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -