title: Struts2 Jquery Ajax form serialize
body: <p>I am learning Struts2 and have the following question on submitting a form with Jquery serialize. I have an action class where I have an object called Policy and the policy class has set of fields as shown below. With jquery ajax I want to set a json string  in my Action class and would like to deserialize it to an object. </p>
  
  <p>How much ever I try, I am not able to set the string I defined in my action class. Below is the code</p>
  
  <pre class="lang-csharp prettyprint-override"><code>Class CassPolicy{
    String policyNumber;
    String name; 
    //getsets for members
  
  }
  </code></pre>
  
  <p>Action:</p>
  
  <pre class="lang-csharp prettyprint-override"><code>Class PolicyAction{
     String cassPolicyString;
     CassPolicy cassPolicy = new CassPolicy();
     //getsets for members
  
     String save(){
  //In save method  I want to convert the policyString to policy object
  //policyString always returns null
     } 
  }
  </code></pre>
  
  <p>JSP:</p>
  
  <pre class="lang-js prettyprint-override"><code>$.ajax({
   url:PolicyAction.action,
   type:'post',
   data:$("#policyForm").serialize(),
   async:true,
   success:function(data){
   }
  
  });
  
  &lt;s:form id="policyForm"&gt;
      &lt;s:textfield name="cassPolicy.policyNumber" label="policyNumber"&gt;&lt;/s:textfield&gt;
      &lt;s:textfield name="cassPolicy.name" label="name"&gt;&lt;/s:textfield&gt; 
  &lt;/s:form&gt;
  </code></pre>
  
  <p>I even tried in ajax something like <code>data:{cassPolicyString:$("#policyForm).serialize()}</code></p>
  
  <p>Can someone help me point to the right direction or what is the right way to achieve my task?</p>