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. fszipx.exe

    来源:http://www.funduc.com/fszipx.htm 是个免费软件,用于把.zip转化为.exe自解压文件. COPY /B "C:\Tools\FsZipX\FsZipX ...

  2. background和background-position相关笔记

    background 可在一个声明中设置background-color,background-image,background-repeat,background-attachment,backgr ...

  3. 关于Ajax的type为post提交方式出现请求失效问题

    最近碰到这样一个问题,原本一个ajax异步提交数据之前是很好的,很多系统都延用了均未出现任何问题.最近这个版本却出现ajax方式post数据不到后台程序,让我折腾了好几天.起初的ajax是这样写的: ...

  4. 使用dom4j解析XML例子

    包括三个文件:studentInfo.xml(待解析的xml文件), Dom4jReadExmple.java(解析的主要类), TestDom4jReadExmple.java(测试解析的结果) 代 ...

  5. Java Networking Related (Java Examples in a Nutshell 3rd Edition)

    Examples to: Use URL class to parse URLs and download the network resources specified by a URL Use U ...

  6. 构建一个最简单的web应用并部署及启动

    第一种构建方式:不使用maven File-new-Dynamic Web Project,用这种方式构建的web项目是在web.xml文件中配置了welcome-file的,但是却没有对应的文件,所 ...

  7. SuperSocket+unity 网络笔记

    学习SuperSocket 必须要注意的 代码是 static void Main(string[] args) { WebSocketServer appServer = new WebSocket ...

  8. IE8浏览器兼容问题总结

    IE8+兼容经验小结 January 15, 2014 本文分享下我在项目中积累的IE8+兼容性问题的解决方法.根据我的实践经验,如果你在写HTML/CSS时候是按照W3C推荐的方式写的,然后下面的几 ...

  9. IIS Express允许外部访问(外部调试)

    Visual Studio配合IIS Express为Web开发提供了强劲的调试功能,本文介绍IIS Express如何在调试模式下让局域网的其他设备进行访问,以便进行测试. 1.打开IIS Expr ...

  10. php 文件夹遍历俩种对比

    configu.phpindex.php新建文件夹 D:\xampp\htdocs\1test\use\useversion/configu.phpD:\xampp\htdocs\1test\use\ ...