title: Struts2 + Jquery Library - What is wrong on this AJAX call?
body: <p>Im trying some ajax call with Struts2 and the JQuery library. This is the code of the jsp :</p>
  
  <pre><code>&lt;s:div id="my_result" &gt;
      Nothing
  &lt;/s:div&gt;
  
  &lt;s:form action="UserManager" theme="simple"&gt;
      &lt;s:textfield name="nickname" /&gt;
      &lt;s:password name="password" /&gt;
      &lt;s:label cssClass="menu_span"&gt;
          &lt;sj:submit targets="my_result" value="Login" /&gt;
      &lt;/s:label&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p>this is the code of the bean/action with the xml :</p>
  
  <pre><code>public class UserManager extends ActionSupport {
      private String nickname;
      private String password;
  
      @Override
      public String execute() throws Exception {
          String output="i have insered "+this.getNickname()+" and "+this.getPassword();
          System.out.println(output);
          return output;
      }
  
      public String getNickname() { return nickname; }
      public void setNickname(String newValue) { nickname=newValue; }
  
      public String getPassword() { return password; }
      public void setPassword(String newValue) { password=newValue; }
  }
  
  &lt;package name="model" extends="struts-default"&gt;
      &lt;action name="UserManager" class="model.UserManager"&gt;
          &lt;result&gt;index.jsp&lt;/result&gt;
      &lt;/action&gt;
  &lt;/package&gt;
  </code></pre>
  
  <p>If i <code>return SUCCESS</code> on the UserManager bean, it load on <code>my_result</code> the same calling page. Else, if i <code>return output</code> i get <code>Messages:<br>
  No result defined for action model.UserManager and result i have insered aaa and bbb
  </code> messagge (with nickname=aaa and password=bbb).</p>
  
  <p>What's happened? How can i return that string? I think it's a struts.xml fault</p>
  
  <p>Cheers</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>public class UserManager extends ActionSupport {
      private String nickname;
      private String password;
      private String error;</p>
  
  <pre><code>@Override
  public String execute() throws Exception {
      error="i have insered "+this.getNickname()+" and "+this.getPassword();
      return SUCCESS;
  }
  
  public String getNickname() { return nickname; }
  public void setNickname(String newValue) { nickname=newValue; }
  
  public String getPassword() { return password; }
  public void setPassword(String newValue) { password=newValue; }
  
  public String getError() { return error; }
  public void setError(String newValue) { error=newValue; }
  }
  
  &lt;s:div id="my_result" &gt;
      &lt;s:property value="error" /&gt;
  &lt;/s:div&gt;
  
  &lt;s:form action="UserManager" theme="simple"&gt;
      &lt;s:textfield name="nickname" /&gt;
      &lt;s:password name="password" /&gt;
      &lt;s:label cssClass="menu_span"&gt;
          &lt;sj:submit targets="my_result" value="Login" /&gt;
      &lt;/s:label&gt;
  &lt;/s:form&gt;
  </code></pre>
  
  <p><strong>UPDATE 2</strong></p>
  
  <pre><code>&lt;package name="model" extends="json-default"&gt;
      &lt;action name="UserManager" class="model.UserManager"&gt;
          &lt;result type="json" /&gt;
      &lt;/action&gt;
  &lt;/package&gt;
  </code></pre>