- Mastering Spring 5.0
- Ranga Rao Karanam
- 71字
- 2021-07-02 22:12:16
Example 3
In the following example, there are two RequestMapping methods--one in the class and the other in the method. A combination of both RequestMapping methods is used to determine the URI. The showPage method will be mapped only to the GET request for the URI /user/show-page:
@Controller
@RequestMapping("/user")
public class UserController {
@RequestMapping(value = "/show-page" , method =
RequestMethod.GET)
public String showPage() {
/* Some code */
}
}