A first summary of the next common comment
1. @ Controller controller, the class definition for this controller
2.@RequestMapping
Action
request to establish a path with the method of correspondence between processing request
scope
is defined in the class, as part of the path. Used to distinguish between different modules.
Defined on the method, this method indicates the access path
access path: the path based on the path + Method
access path: http: // localhost: 8080 / order / save.do
Common attributes
value specified request path name
path with value
Method, specify the request method, supported by default get / post
RequestMethod.GET supports only get requests
RequestMethod.POST only support post request
params indicates that the request must take the time parameter name specified value.
3.@RequestParam
When the request method parameter name and the parameter used when inconsistency
1. Role
correspondence relationship establishment request parameters and methods * parameter of
* 2 position
* modification on the method parameters.
* 3. Properties
* value corresponding to the request parameter name
* name value with the
default * required to true, indicates that the request parameter must have otherwise reported error: Bad Request
* defaultValue specify default values for the parameters.
4.RequestHeader
Get the specified request header, method parameters assigned to
5.CookieValue
Get the cookie value corresponding to the specified key
6.RequestBody
Acquisition request body content, post only submit the request body.
get to submit an error.
Second, the analysis SpringMVC how to achieve the requested data and exchange
The main steps
The bottom three components
The first step to resolve the web.xml file
Front controller: intercept request for filtering and
For intercepting requests
This problem is solved with the Chinese garbled
The second step, loading SpringMVC.xml
The first two are commonly used, the latter is the conversion of different types configured
Class request processing controller