Creating a simple @Controller with method-level URL mapping
The previous recipe centralizes on the URL mapping by having a class-level @RequestMapping annotation. This time the goal is to illustrate how a simple @Controller manages handler methods with each having both the HTTP method and request URL settings.
Getting started
Utilize the same Eclipse STS project ch03 to implement our @Controller and its components. This recipe focuses on other ways of dealing with @Controller and @RequestMapping with the inclusion of using other HTTP methods such as DELETE and PUT. In relation to the PUT method, the recipe will discuss file uploading at the side.
How to do it...
To perform different ways of URL mapping to types of HTTP request handlers, follow these steps:
- Since
ch03is a working project already, let us add a simple controller,SimplePatternsController,with three handler methods handlingGETandPOSTtransactions inside theorg.packt.dissect.mvc.controllerpackage. This simple controller has...