title: Calling method via Ajax in Struts 1
body: <p>I have action class that derive from DispatchAction. I want to call a method from in there using ajax. When I click the button that is shown below, I want to go InvitationAction's add method.
  Fault is "Request[/InvitationAction] does not contain handler parameter named method."
  Thanks in advance.</p>
  
  <pre><code>public class InvitationAction extends DispatchAction{
  
  public ActionForward add(ActionMapping mapping, ActionForm form, 
          HttpServletRequest request, HttpServletResponse response){
      InvitationForm invForm = (InvitationForm)form;
      Person newPerson = new Person();
      newPerson.setFirstName(invForm.getFirstName());
      newPerson.setLastName(invForm.getLastName());
      invForm.getPersonMap().put(invForm.getKey(), newPerson);
      invForm.reset(mapping, request);
      return mapping.findForward("success");
  }
  
  public ActionForward delete(ActionMapping mapping, ActionForm form, 
          HttpServletRequest request, HttpServletResponse response){
      InvitationForm invForm = (InvitationForm)form;
      invForm.getPersonMap().remove(invForm.getKey());
      return mapping.findForward("success");
  }
  
  public ActionForward edit(ActionMapping mapping, ActionForm form, 
          HttpServletRequest request, HttpServletResponse response){
      InvitationForm invForm = (InvitationForm)form;
      Person person = invForm.getPersonMap().get(invForm.getKey());
      invForm.setFirstName(person.getFirstName());
      invForm.setLastName(person.getLastName());
      return mapping.findForward("success");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>.jsp side</p>
  
  <pre><code>function doAjaxPost() {  
  
    $.ajax({  
      type: "POST",  
      url: "/AjaxWithStruts1/InvitationAction.do?action=edit",
      success: function(response){  
        // we have the response  
        $('#info').html(response);  
      },  
      error: function(e){  
        alert('Error: ' + e);  
  
      }  
    });  
  }  
  
  &lt;input type="button" value="add" onclick="doAjaxPost()"&gt;&lt;br/&gt;
  </code></pre>
  
  <p>struts-config.xml side</p>
  
  <pre><code>&lt;action-mappings&gt;
  
      &lt;action name="invitationForm" path="/invitation" type="com.raistudies.actions.InvitationAction" 
      scope="session" input="/index.jsp" parameter="action"&gt;
          &lt;forward name="success" path="/index.jsp" redirect="true"/&gt;
      &lt;/action&gt;
  
  &lt;/action-mappings&gt;
  </code></pre>