title: How to get checked value of checkbox in Struts 2 tag <s:checkbox> into action class
body: <p>In Struts 2 form, i am iterating through a list and displaying the records along with a checkbox, to perform update/delete operations. </p>
  
  <p>My requirement is if the checkbox is selected(means, if the value is true), perform the required operation on the selected record. But every time i am getting the false value for the check box into my action class and also i am not getting the updated text field values into action class.</p>
  
  <p>Below is the action, form and jsp code:</p>
  
  <pre><code>    // Initial action class to prepare the list to display in jsp
  
      public class SetupCategoryMod implements ServletRequestAware, ModelDriven&lt;ManageFundCategoryForm&gt; {
          private HttpServletRequest request;
          private ManageFundCategoryForm theForm =  new ManageFundCategoryForm();
          public String execute() throws Exception {  
              Vector list = doGetFundCatergory(); // This list iam getting fine from DB
              theForm.setWs(list); // Setting to pojo
              return "success";
          }
          @Override
          public void setServletRequest(HttpServletRequest httpServletRequest) {
              this.request = httpServletRequest;
          }
          @Override
          public ManageFundCategoryForm getModel() {
              return theForm;
          }
      }
  
      // POJO for data binding 
  
      public class ManageFundCategoryForm  {
          private Vector&lt;FundCategoryData&gt; ws;
          // setter and getter for the property here
      }
  
      // supporting pojo for form binding 
  
      public class FundCategoryData implements Serializable {
          private static final long serialVersionUID = 8509788495819453084L;
          private String fname;
          private boolean action;
  
         //setters and getters for the properties here
      }
  </code></pre>
  
  <p>jsp </p>
  
  <pre><code>    &lt;s:form action="managefundcategory"&gt;
      &lt;s:iterator value="ws" status="stat"&gt;               
      &lt;tr&gt;
          &lt;td align="center"&gt;&lt;s:checkbox name="ws[%{#stat.index}].action" value="action"/&gt;
          &lt;td align="center"&gt;&lt;s:textfield name="ws[%{#stat.index}].fname" size="26"/&gt;
      &lt;/s:iterator&gt;
      &lt;/s:form&gt;
  </code></pre>
  
  <p>Action after submitting the above form with updated values. BUT THE UPDATED VALUES ARE NOT POPULATING TO THE ACTION. OLD VALUES ONLY COMING AGAIN. EVEN AFTER CHECKING THE CHECKBOX, I AM ONLY GETTING "false" VALUE INTO MY ACTION CLASS</p>
  
  <pre><code>    public class ManageFundCategoryAction implements ServletRequestAware, ModelDriven&lt;ManageFundCategoryForm&gt; {
          private HttpServletRequest request;
          private ManageFundCategoryForm theForm = new ManageFundCategoryForm();
          public String execute() throws Exception {                  
              Iterator itr = theForm.getWs().iterator();
              while(itr.hasNext()){ //Printing the values to check if the updated values are coming or not.
                  FundCategoryData fdd = (FundCategoryData)itr.next();
                  System.out.println(fdd.isAction()+" , "+fdd.getFname());
              }
  
              //send the updated list to db
              if(update(theForm.getWs()) != 0){
                  return "success";
              }
          }
          @Override
          public ManageFundCategoryForm getModel() {
              return theForm;
          }
          @Override
          public void setServletRequest(HttpServletRequest httpServletRequest) {
              this.request = httpServletRequest;
          }
      }
  </code></pre>
  
  <p>Please suggest me how to get the updated values for textfield and checkbox into the submitted action class?</p>
  
  <p>I am getting the below exception in logs after submitting the form</p>
  
  <pre><code>20:13:06,846 ERROR [com.opensymphony.xwork2.util.InstantiatingNullHandler] (http-localhost/127.0.0.1:8080-11) Could not create and/or set value back on to object: ognl.OgnlException: ws [java.lang.IllegalArgumentException: java.lang.ClassCastException@1f17f83]
      at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:83) [ognl-2.6.11.jar:]
      at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131) [ognl-2.6.11.jar:]
      at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68) [xwork-2.0.4.jar:]
      at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656) [ognl-2.6.11.jar:]
      at ognl.ASTProperty.setValueBody(ASTProperty.java:101) [ognl-2.6.11.jar:]
      at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) [ognl-2.6.11.jar:]
      at ognl.SimpleNode.setValue(SimpleNode.java:246) [ognl-2.6.11.jar:]
      at ognl.Ognl.setValue(Ognl.java:476) [ognl-2.6.11.jar:]
      at ognl.Ognl.setValue(Ognl.java:494) [ognl-2.6.11.jar:]
      at com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(InstantiatingNullHandler.java:106) [xwork-2.0.4.jar:]
      at ognl.ASTProperty.getValueBody(ASTProperty.java:94) [ognl-2.6.11.jar:]
      at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170) [ognl-2.6.11.jar:]
      at ognl.SimpleNode.getValue(SimpleNode.java:210) [ognl-2.6.11.jar:]
      at ognl.ASTChain.setValueBody(ASTChain.java:168) [ognl-2.6.11.jar:]
      at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) [ognl-2.6.11.jar:]
      at ognl.SimpleNode.setValue(SimpleNode.java:246) [ognl-2.6.11.jar:]
      at ognl.Ognl.setValue(Ognl.java:476) [ognl-2.6.11.jar:]
      at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:158) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:146) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:193) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:159) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83) [struts2-core-2.0.11.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207) [struts2-core-2.0.11.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107) [struts2-core-2.0.11.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206) [struts2-core-2.0.11.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170) [struts2-core-2.0.11.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [xwork-2.0.4.jar:]
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) [xwork-2.0.4.jar:]
      at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50) [struts2-core-2.0.11.jar:]
      at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504) [struts2-core-2.0.11.jar:]
      at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419) [struts2-core-2.0.11.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.4.8.Final-redhat-4.jar:7.4.8.Final-redhat-4]
      at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_101]
  </code></pre>