title: How to use jQuery to post JSON data to a Struts2 Action class
body: <p>I've a problem sending data from jQuery to struts2 action class.
  I have seen the question: <a href="https://stackoverflow.com/questions/12746051/json-jquery-to-struts2-action">JSON Jquery to Struts2 action</a> but I don't understand the solution quite well.</p>
  
  <p>Here is my problem:</p>
  
  <p>The json array is like this:</p>
  
  <pre><code>[{"id":"1","code":"111","name":"ddd"},
   {"id":"2","code":"222","name":"sss"},
   {"id":"3","code":"333","name":"eee"}]
  </code></pre>
  
  <p>I want to send the json data to the struts2 action class. 
  The jQuery code is like this:</p>
  
  <pre><code>var data = JSON.stringify(dataObj);
  $.ajax({
    url: "Update",
    type: "post",
    data:  data,
    dataType: 'json',
    contentType:"application/json;charset=utf-8",
    success : function(){
      alert("You made it!");
    }
  });
  </code></pre>
  
  <p>However, in Chrome's Development Tool, I have seen the data submitted to the server side. But on the server side, I don't know how receive the json data.</p>
  
  <p>Action:</p>
  
  <pre><code>public class Update extends ActionSupport{
      private String data;
  
      public String getData(){
          return data;
      }
  
      public void setData(String data){
          this.data= data;
      }
  
      public String execute(){
          System.out.println(data);
          return SUCCESS;
      }
  }
  </code></pre>
  
  <p>In this way, <code>data</code> is null.</p>
  
  <p>I've also tried to use a List to receive JSON data. Changing "data" type from String to <code>List&lt;Node&gt;</code>, it failed again. Probably because I don't quite understand the OGNL model which Struts2 is using.</p>
  
  <p>Please Help Me. Thank you very much!</p>