1.@RequestParam

  1. @RequestMapping(value = "/xxxx.do")
  2. public void create(@RequestParam(value="userName") String userName) throws Exception {
  3. }
	@RequestMapping(value = "/xxxx.do")
public void create(@RequestParam(value="userName") String userName) throws Exception { }

2.@PathVariable

  1. @RequestMapping(value="/{groupId}.do")
  2. public void detail(@PathVariable long groupId){
  3. groupRepository.selectOne(groupId);
  4. }
	@RequestMapping(value="/{groupId}.do")
public void detail(@PathVariable long groupId){
groupRepository.selectOne(groupId);
}

3.@ModelAttribute

  1. @RequestMapping(value = "/xxxx.do")
  2. public String create(@ModelAttribute User user) throws Exception {
  3. userService.insert(user);
  4. return "redirect:/user/create.do";
  5. }
	@RequestMapping(value = "/xxxx.do")
public String create(@ModelAttribute User user) throws Exception {
userService.insert(user);
return "redirect:/user/create.do";
}

4.Request对象

  1. public ModelAndView method1(HttpServletRequest request,
  2. HttpServletResponse respnose) throws ServletException, IOException {
  3. Map model = new HashMap();
  4. model.put("message", "你调用的是方法1");
  5. return new ModelAndView("/index.jsp", "model", model);
  6. }

SpringMVC 接收表单数据的方式 - Samuel - 博客频道 - CSDN.NET的更多相关文章

  1. SpringMVC 接收表单数据的方式

    1.@RequestParam @RequestMapping(value = "/xxxx.do") public void create(@RequestParam(value ...

  2. SpringMVC 接收表单数据、数据绑定、解决请求参数中文乱码

    接收表单数据有3种方式. 1.使用简单类型接收表单数据(绑定简单数据类型) 表单: <form action="${pageContext.request.contextPath}/u ...

  3. docker mysql 数据持久化到本地、设置不区别表名大小写-清风柳絮-51CTO博客

    原文:docker mysql 数据持久化到本地.设置不区别表名大小写-清风柳絮-51CTO博客 Docker MySQL 把数据存储在本地目录,很简单,只需要映射本地目录到容器即可 1.加上-v参数 ...

  4. myssql数据库表名转驼峰 - PLAY - ITeye博客

    原文:myssql数据库表名转驼峰 - PLAY - ITeye博客

  5. js清空表单数据的方式(遍历+reset)

    方法1:遍历页面元素 /* 清空FORM表单内容 id:表单ID*/ function ClearForm(id) { var objId = document.getElementById(id); ...

  6. springmvc接收json数据的常见方式

    经常使用Ajax异步请求来进行数据传输,传的数据是json数据,json数据又有对象,数组.所有总结下springmvc获取前端传来的json数据方式:1.以RequestParam接收前端传来的是j ...

  7. servlet获取表单数据的方式和编码方式

    .在servlet中获取表单的数据的几种方式  1>request.getParameter(“name”)://获取指定名称的值,返回值类型是一个字符串  2>request.getPa ...

  8. SpringMVC接收前端传值有哪些方式?

    有很多种,比如: 1.通过@RequestParam注解接收请求参数: 2.通过Bean封装,接收多个请求参数 3.通过@ModelAttribute绑定接收前端表单数据 4.通过@PathVaria ...

  9. springMVC接收参数的几种方式

    Spring3 MVC请求参数获取的几种方法 一.      通过@PathVariabl获取路径中的参数 @RequestMapping(value="user/{id}/{name}&q ...

随机推荐

  1. hh monitor

    http://theholyjava.wordpress.com/2012/09/21/enabling-jmx-monitoring-for-hadoop-and-hive/ http://blog ...

  2. NSNumber(把数字存进数组字典等的问题)

    官方文档地址https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSNum ...

  3. win32使用ATL显示C#COM窗体

    显示效果如图: 环境:win7 64.VS2013 代码如下: #include <atlbase.h> #include <atlhost.h> // 导入 #import ...

  4. Math类的round方法小解

    在Math类中有三个关于“四舍五入”的静态方法(ceil,floor,round): ① Math.ceil(number) 向上取整,Math.ceil(11.2) 结果:12            ...

  5. Linux学习 -- Shell基础 -- Bash基本功能

    历史命令 history -c   clear -w   写入 ~/.bash_history 默认保存1000条, 可在/etc/profile中修改 调用 Tab补全 命令.目录.文件 命令别名 ...

  6. 多校 Robot Motion

    题目链接:http://acm.hust.edu.cn/vjudge/contest/124435#problem/J 密码:acm Sample Input NEESWE WWWESS SNWWWW ...

  7. springmvc json数据

    的 @RequestMapping("/getAllEdu") @ResponseBody public void getAllEdu(HttpServletRequest req ...

  8. web开发后端开源库收集

    1.Gregwar/Captcha 项目地址:https://github.com/Gregwar/Captcha

  9. stdarg.h头

    stdarg.h 头文件,主要目的是让函数可以接受可变参数. va_list :用来保存宏va_arg与宏va_end所需信息. va_start :使va_list指向起始的参数 va_arg :检 ...

  10. docker rancher 体验 (未完待续.....)

    docker rancher 体验 官方 githubhttps://github.com/rancher/rancher 环境说明: 10.6.0.14010.6.0.18710.6.0.188 修 ...