Brief introduction:
@RequestMapping
Requestmapping is an annotation that handles request address mappings and can be used on classes or methods. On a class, the method that represents all response requests in a class is the parent path of the address.
The requestmapping annotation has six properties, and we'll describe her in three categories below.
1, value, method;
Value: Specifies the actual address of the request, the specified address can be the URI Template mode (which will be explained later);
Method: Specifies the type of method requested, GET, POST, PUT, delete, and so on;
2, Consumes,produces;
Consumes: Specifies the type of submission to process the request (Content-type), such as Application/json, text/html;
Produces: Specifies the type of content returned, only if the specified type is included in the (Accept) type in the request header;
3, Params,headers;
Params: Specifies that some parameter values must be included in the request before the method is processed.
Headers: Specifies that certain header values must be included in the request in order for the method to process requests.
Summary:
A. Using @requestmapping annotations to map request URLs specify which URL requests can be processed for the controller
B. Use method to specify the request method, @RequestMapping (value= "/login_tologin" Method=requestmethod.post), at which time to mate the form
Post mode submission
[Email protected] annotations support wildcard characters? --Match a character in the file name *--any character in the matching file **--match a multilayer path
[email protected] can map placeholders in URLs to parameters in the target method
E. Rest-style URLs take crud as an example:
Now way: Before Way
Added:/order POST
Modified:/ORDER/1 PUT update?id=1
Get:/ORDER/1 Get get?id=1
Delete:/ORDER/1 Delete delete?id=1
@RequestMapping Annotation Usage