How to do it...

To perform different ways of URL mapping to types of HTTP request handlers, follow these steps:

  1. Since ch03 is a working project already, let us add a simple controller, SimplePatternsController, with three handler methods handling GET and POST transactions inside the org.packt.dissect.mvc.controller package. This simple controller has both the class-level and method-level @RequestMapping annotations, through which the request URLs will be determined based on the class level going down to the URL of its respective handler methods:
@Controller @RequestMapping("/simple") public class SimplePatternsController { @RequestMapping(value="/form_upload_get.html", method=RequestMethod.GET) public String uploadFileFormGet(Model model) ...

Get Spring 5.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.