<mvc:annotation-driven/>
启动注解,自动注册DefaultAnnotationHandlerMapping,AnnotationMethodHandlerAdapter。
RequestMapping有五种URL映射方式:
1、标准URL映射
2、Ant风格的URL映射
?:匹配单个字符
*:匹配0个或者多个字符
**:匹配0个或者多个/分隔符
3、占位符映射:可以通过一个或多个{xxxx}占位符映射。如/user/{userId}/{method}/show
需要在请求方法的相应传参前添加注解(@PathVariable("userId") String userId, @PathVariable("mthod") String method)
4、限制请求方法映射
RequestMapping(value="/{userId}/query",method=RequestMethod.GET)
5、限制参数映射: 限定参数必须符合的条件