I am pretty new in Spring MVC and I have the following doubt.
In a controller, I have a method annotated in this way:
@Controller
@RequestMapping(value = "/users")
public class UserController {
@RequestMapping(params = "register")
public String createForm(Model model) {
model.addAttribute("user", new Customer());
return "user/register";
}
}
So this method handle HTTP Request toward the URL /users?register where register is a parameter (because the entire class handle request toward /users resource).
Is it the same thing if, instead using the params = "register" I use the following syntaxt:
@Controller
public class UserController {
@RequestMapping("/users/{register}")
public String createForm(Model model) {
model.addAttribute("user", new Customer());
return "user/register";
}
}
I have deleted the mapping at class level and I use @RequestMapping("/users/{register}").
Is it the same meaning of the first example?