title: Spring: Form is not getting redirected to given method in action url while submitting it
body: <p>I'm starting to learn spring framework and in my code I'm simply trying to create an empty form and checking whether it is getting redirected to proper controller method. When i specify a javascript function in form submission action the function is getting executed but when I specify an URL which can be mapped to a controller method, the controller method is not getting called instead it is going to mainPage of the application. I'm not getting any errors in the log. Please guide on this.</p>
  
  <p><strong>My view (.ftl):</strong></p>
  
  <pre><code>&lt;div class="form-page-header"&gt;
    &lt;h4 class="page-heading"&gt;First exercise&lt;/h4&gt;
  &lt;/div&gt;
  &lt;form id="EmptyForm" class="form-horizontal" method="post" action="&lt;@spring.url  "/user/create"/&gt;"&gt;
    &lt;div class="panel panel-default"&gt;
      &lt;div class="panel-heading"&gt;
        &lt;b&gt;User Details&lt;/b&gt;
      &lt;/div&gt;
      &lt;div class="panel-body"&gt;
  
        &lt;div class="col-sm-6 form-group"&gt;
          &lt;label class="col-sm-5 control-label"&gt;Create New User&lt;/label&gt;
  
          &lt;div class="col-sm-7"&gt;
  
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class="form-group pull-left"&gt;
      &lt;input type="submit" class="btn btn-default" value="Submit" /&gt;
    &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>My Controller:</p>
  
  <p><strong>UserController.java</strong></p>
  
  <pre><code>@Controller
  @RequestMapping(value = "/user")
  public class ServerController implements MessageSourceAware {
  
      private MessageSource messages;
      private UserService userService;
  
  
      @Override
      public void setMessageSource(MessageSource messageSource) {
          this.messages = messageSource;
      }
  
      @Autowired
      public void setUserService(UserService userService) {
          this.userService = userService;
      }
  
      @RequestMapping(value = "/", method = RequestMethod.GET)
      public String list(ModelMap modelMap) {
          System.out.println("inside user controller");
          return "user/view";
      }
  
      @RequestMapping(value = "/create", method = RequestMethod.POST)
      public ModelAndView create(ModelMap modelMap) {
          System.out.println("create server mapped...");
          modelMap.addAttribute("server", new User());
          ModelAndView mnv = new ModelAndView();
          mnv.setViewName("user/view");
          return mnv;
      }
  }
  </code></pre>