title: Context root not coming while submitting Spring form - issues with url pattern
body: <p>Below are my contoller , web xml and jsp page which uses spring form.</p>
  
  <p>Controller</p>
  
  <pre><code>@Controller
  @RequestMapping(value = {"/*", "/login"})
  public class HelloWorldController {
  
      @RequestMapping(method = RequestMethod.GET)
      public String helloWorld(final Model model) {
          model.addAttribute("bodyPage", "body.jsp");
          User user = new User();
          Address address = new Address();
  
          user.setAddress(address);
  
          model.addAttribute("myUser", user);
          System.out.println("hello world");
          return "login";
      }
  
  
      @RequestMapping(value = "/submitDetails", method = RequestMethod.POST)
      public ModelAndView submitDetais(final Object command) {
  
          System.out.println("inside submitDetais ");
          User user = (User) command;
          return new ModelAndView("result", "user", user);
      }
  }
  </code></pre>
  
  <p>Web Xml</p>
  
  <pre><code>&lt;servlet&gt;
          &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>Jsp Page</p>
  
  <pre><code>&lt;form:form commandName="myUser" modelAttribute="myUser" method="POST" action="submitDetails.htm" &gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;First Name:&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="firstName" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Last Name:&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="lastName" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td&gt;Address 1:&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="address.address1"  /&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td&gt;Address 2:&lt;/td&gt;
              &lt;td&gt;&lt;form:input path="address.address2"  /&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td colspan="2"&gt;&lt;input type="submit" value="Save Changes" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>Dispathcher servlet has only view resolver. Now as per the class level url pattern defined in Contoller if I navigate to the below url
  <em><a href="http://localhost:9080/ExampleSpring" rel="nofollow">http://localhost:9080/ExampleSpring</a></em> or <em><a href="http://localhost:9080/ExampleSpring/" rel="nofollow">http://localhost:9080/ExampleSpring/</a></em></p>
  
  <p>controll is going to my jsp page and asking for details. After entering details if I submit the form with the form action as 
  <strong>action="submitDetails.htm"</strong> as mentioned in action , its throwing  404 error. And the url in the address bar is coming as 
  <strong>localhost:9080/submitDetails.htm</strong>
  which is missing the Context root for the project. My question is what am I doing wrong in the requehst mapping url section ?</p>
  
  <p>As per my understanding </p>
  
  <p>1.the form is submitted using post which mathes the pattern
    2. /submitDetails.htm is matching the pattern /* in the class level url pattern mapping so the request should enter the controller,
    3. and lastly the method level mapping in controller's method is having 
       same url pattern amd request method as the action amd methood
      in jsp so it should enter the controllers method and print in the
      console--- which is not happeing.</p>
  
  <p>Could anyone please help me understand this? </p>