摘要: 在SpringMVC后台控制层获取参数的方式主要有两种,一种是request.getParameter("name"),另外一种是用注解@RequestParam直接获取。这里主要讲这个注解 一、基本使用,获取提交的参数后端代码:Java代码 @RequestMapping("testRe... 阅读全文
posted @ 2015-10-14 16:59 ChrisMurphy 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 1.@ModelAttribute注释方法 例子(1),(2),(3)类似,被@ModelAttribute注释的方法会在此controller每个方法执行前被执行,因此对于一个controller映射多个URL的用法来说,要谨慎使用。 (1)@ModelAttribute注释void返回值的方... 阅读全文
posted @ 2015-10-14 16:49 ChrisMurphy 阅读(537) 评论(0) 推荐(0) 编辑
摘要: 先看一个简单的实例:@Controller@RequestMapping("/hello")public class anyTypeController{ @RequestMapping(method={RequestMethod.GET,RequestMethod.POST}) pub... 阅读全文
posted @ 2015-10-14 16:12 ChrisMurphy 阅读(5645) 评论(0) 推荐(0) 编辑