1、@PathVariable
@RequestMapping("/pets/{petId}")
2、@RequestHeader
@RequestMapping("/pets/{petId}")
获取Request 的header部分
Host
Accept
Accept-Language
Accept-Encoding
3、@CookieValue
JSESSIONID=415A4AC178C59DACE0B2C9CA
public void displayHeaderInfo(@CookieValue("JSESSIONID") String cookie)
}
4、@RequestParam
public String getPata(@RequestParam("test") String test, ModelMap model) {
}
5、@RequestBody
常用来处理Content-Type: 不是application/x-www-form-urlencoded编码的内容,例如application/json, application/xml等;
因为配置有FormHttpMessageConverter
@RequestMapping(value = "/something", method = RequestMethod.PUT)
public void handle(@RequestBody String body, Writer writer) throws IOException {
}
6、@SessionAttributes
7、@ModelAttribute
将request级别的对象,变成session级别的,即,请求结束后会被保存起来,供其它方法使用
spring学习之@SessionAttributes详解
http://blog.csdn.net/li_xiao_ming/article/details/8349178
http://www.2cto.com/kf/201410/346482.html
hibernate之实体@onetomany和@manytoone双向注解