O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a controller

We will use the following BankController class for URL mapping:

@Controllerpublic class BankController {    @GetMapping("/")  public ModelAndView home(Principal principal) {    ModelAndView model = new ModelAndView();    model.addObject("title", "Welcome to Bank");    model.addObject("message", "Hi " + principal.getName());    model.setViewName("index");    return model;  }    @GetMapping("/admin**")  public ModelAndView adminPage() {    ModelAndView model = new ModelAndView();    model.addObject("title", "Welcome to Admin Panel");    model.addObject("message", "This is secured page - Admin     Panel");    model.setViewName("admin");    return model;  }    @PostMapping("/logout")  public String logout(HttpServletRequest request,   HttpServletResponse  response) { ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required