摘要: 1. @RequestMapping注解的作用位置 @RequestMapping可以作用在类名上,也可以作用在方法上。 如果都有, 产生作用的路径是类名上的路径+方法上的路径。 比如EmployeeController的add方法,最终起作用的路径是 http://host:port/contex 阅读全文
posted @ 2016-10-31 23:13 Timesyys 阅读(131) 评论(0) 推荐(0) 编辑
摘要: spring mvc中的@PathVariable是用来获得请求url中的动态参数的,十分方便,复习下: 、 @Controller public class TestController { @RequestMapping(value="/user/{userId}/roles/{roleId}" 阅读全文
posted @ 2016-10-31 22:27 Timesyys 阅读(356) 评论(0) 推荐(0) 编辑
摘要: @ModelAttribute使用详解 1.@ModelAttribute注释方法 例子(1),(2),(3)类似,被@ModelAttribute注释的方法会在此controller每个方法执行前被执行,因此对于一个controller映射多个URL的用法来说,要谨慎使用。 (1)@ModelAt 阅读全文
posted @ 2016-10-31 22:24 Timesyys 阅读(243) 评论(0) 推荐(0) 编辑