SpringMVC 常用注解

@Controller  控制类注解
@RequestMapping("index.do") 请求地址的映射

// required=false表示不传的话,会给参数赋值为null,required=true就是必须要有
@RequestParam(value = "channelId", required = false) Integer channelId) //获取请求参数
request.getParameter("channelId") //获取请求参数

@Scope("prototype") 1. singleton 单例 2. prototype 多例 3. request ,session和global session

@Resource(name="xxxxService")
private XxxxService xxxxService; Action类中 Service注解

@ModelAttribute 注释的方法会在此controller每个方法执行前被执行


 
 



 
posted @ 2016-09-20 14:01  hy_ag  阅读(141)  评论(0编辑  收藏  举报