title: How to call different methods defined in one action in struts2?
body: <p>I'm not familiar with struts2, but I know that method execute() is called as default in Action during call to action by name. But how to call other method defined in the same action class?</p>
  
  <p>In an example below execute() method is called when I set url link in ajax like that: <code>saveJSONDataAction.action</code> thanks to @Action annotation.</p>
  
  <p>How the url should looks like to call otherMethod() by ajax?</p>
  
  <p>Action class:</p>
  
  <pre><code>@ParentPackage("json-default")
  @Action(value="getJSONDataAction")
  @Result(name="success", type="json")
  public class JSONDataAction extends ActionSupport {
      private static final long serialVersionUID = 1L;
  
      private List&lt;Report&gt; data = new ArrayList&lt;Report&gt;();
  
      public JSONDataAction(){
          data.add(new Report(1, "Chris", true, "2008-01-01", "orange"));
      }
  
      public String execute() {
          return SUCCESS;
      }
  
      public String otherMethod() {
          //do something else ..
          return SUCCESS;
      }
  
      // getters and setters
  }
  </code></pre>
  
  <p>Ajax call:</p>
  
  <pre><code>$.ajax({
      url: "../json/saveJSONDataAction.action",
      data: data,
      dataType: 'json',
      contentType: 'application/json',
      type: 'POST',
      success: function (res) {
        if (res.result === 'ok') {
          $console.text('Data saved');
        }
      }
  });
  </code></pre>
  
  <p>How to call otherMethod() method by ajax?</p>