title: spring mvc prevent direct access a method
body: <p>I just started learning spring mvc 3. I found a small problem where my controller would handle a post request (registration form). but if type the mapping value (bla3/save.html) in address bar, it will execute the method which it shouldn't. That's why I need a solution for this, if someone type the address directly, it should redirect to other pages instead trying to add new user.</p>
  
  <pre><code>@RequestMapping(value = "/save", method = RequestMethod.POST) //save new user
  public ModelAndView saveUser(@ModelAttribute("user") User user, BindingResult result){
      userService.addUser(user);  
      return new ModelAndView("redirect:/users.html");
  }
  </code></pre>