Portion of the request SpringMVC

1, receiving a request defining a type of request

Only accept requests Post

@RequestMapping(value="",method=RequestMethod.POST)

Accepts only get request

@RequestMapping(value="",method=RequestMethod.GET)

The default GET and POST are accessible without writing

2, receives a request of defining parameters must pass

For example, you must pass a parameter name is the name of the name, or else not to visit

@RequestMapping(params={"name"})

3, a simple type of receiving a request to accept parameter

Fill in the number and name of the parameter directly in the Parameters section of the processor, but the parameter name and parameter names must be sent by consensus.

4, the receiver receives the request received object type

Fill in the parameters directly to the processor Pojo objects, SpringMVC package will be completed automatically, but requires a pass over the parameter name to be removed and set method names of objects set the first letter lowercase consistent.

5, a complex type of the request parameters received

QueryVo objects

 

front end

Backstage

 6, an array of receiving a request type

Request parameter name the same attribute came, same type, the background of the receiving processor directly through the array type parameters.

7, the date of receiving the request type parameter

 

8, receives the request for setting the default value

9, receiving a request header manner

10, receiving Cookie

12, preprocessing parameters

method one

 

Second way

 

Guess you like

Origin www.cnblogs.com/kitor/p/10979124.html