title: Spring mapping form's action to the controller
body: <p>I am new to the Spring Framework and I have created a controller with the method</p>
  
  <pre><code>@RequestMapping("/fetch/{contactId}")
  public String getContact(@PathVariable("contactId") Long contactId,
          Map&lt;String, Object&gt; map, HttpServletRequest request,
          HttpServletResponse response) {
  
      Contact contact = contactService.get(contactId);
      map.put("contact", contact);
      return "contact";
  }
  </code></pre>
  
  <p>This fetch method is called to retrieve the contact details when the user clicks on the link on a jsp</p>
  
  <pre><code>&lt;td&gt;&lt;a href="fetch/${contact.id}" class="edit"&gt;Edit&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>It then successfully returns the contact object and displays on the screen for the user to change and save. The form tag of my jsp is like this</p>
  
  <pre><code>&lt;form:form method="post" action="add.html" commandName="contact"
          id="contact" onsubmit="return validateContact(this)"&gt;
  </code></pre>
  
  <p>Now the problem is when I try to submit the page to another method in the same controller the URL changes to </p>
  
  <p><em>/myapp/app/contacts/fetch/add.html</em></p>
  
  <p>whereas it should be</p>
  
  <p><em>/myapp/app/contacts/add.html</em></p>
  
  <p>I know there is something which I am not doing correctly but what exactly I am not able to figure out. Appreciate if any one of you could help me resolve the issue</p>
  
  <p>Thanks
  AA</p>