SpringMVC 接收表单数据的方式 - Samuel - 博客频道 - CSDN.NET
1.@RequestParam
- @RequestMapping(value = "/xxxx.do")
- public void create(@RequestParam(value="userName") String userName) throws Exception {
- }
@RequestMapping(value = "/xxxx.do")
public void create(@RequestParam(value="userName") String userName) throws Exception { }
2.@PathVariable
- @RequestMapping(value="/{groupId}.do")
- public void detail(@PathVariable long groupId){
- groupRepository.selectOne(groupId);
- }
@RequestMapping(value="/{groupId}.do")
public void detail(@PathVariable long groupId){
groupRepository.selectOne(groupId);
}
3.@ModelAttribute
- @RequestMapping(value = "/xxxx.do")
- public String create(@ModelAttribute User user) throws Exception {
- userService.insert(user);
- return "redirect:/user/create.do";
- }
@RequestMapping(value = "/xxxx.do")
public String create(@ModelAttribute User user) throws Exception {
userService.insert(user);
return "redirect:/user/create.do";
}
4.Request对象
- public ModelAndView method1(HttpServletRequest request,
- HttpServletResponse respnose) throws ServletException, IOException {
- Map model = new HashMap();
- model.put("message", "你调用的是方法1");
- return new ModelAndView("/index.jsp", "model", model);
- }
SpringMVC 接收表单数据的方式 - Samuel - 博客频道 - CSDN.NET的更多相关文章
- SpringMVC 接收表单数据的方式
1.@RequestParam @RequestMapping(value = "/xxxx.do") public void create(@RequestParam(value ...
- SpringMVC 接收表单数据、数据绑定、解决请求参数中文乱码
接收表单数据有3种方式. 1.使用简单类型接收表单数据(绑定简单数据类型) 表单: <form action="${pageContext.request.contextPath}/u ...
- docker mysql 数据持久化到本地、设置不区别表名大小写-清风柳絮-51CTO博客
原文:docker mysql 数据持久化到本地.设置不区别表名大小写-清风柳絮-51CTO博客 Docker MySQL 把数据存储在本地目录,很简单,只需要映射本地目录到容器即可 1.加上-v参数 ...
- myssql数据库表名转驼峰 - PLAY - ITeye博客
原文:myssql数据库表名转驼峰 - PLAY - ITeye博客
- js清空表单数据的方式(遍历+reset)
方法1:遍历页面元素 /* 清空FORM表单内容 id:表单ID*/ function ClearForm(id) { var objId = document.getElementById(id); ...
- springmvc接收json数据的常见方式
经常使用Ajax异步请求来进行数据传输,传的数据是json数据,json数据又有对象,数组.所有总结下springmvc获取前端传来的json数据方式:1.以RequestParam接收前端传来的是j ...
- servlet获取表单数据的方式和编码方式
.在servlet中获取表单的数据的几种方式 1>request.getParameter(“name”)://获取指定名称的值,返回值类型是一个字符串 2>request.getPa ...
- SpringMVC接收前端传值有哪些方式?
有很多种,比如: 1.通过@RequestParam注解接收请求参数: 2.通过Bean封装,接收多个请求参数 3.通过@ModelAttribute绑定接收前端表单数据 4.通过@PathVaria ...
- springMVC接收参数的几种方式
Spring3 MVC请求参数获取的几种方法 一. 通过@PathVariabl获取路径中的参数 @RequestMapping(value="user/{id}/{name}&q ...
随机推荐
- mxml日期显示使用
mxml代码: <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx= ...
- go mode
https://github.com/dominikh/go-mode.el http://blog.altoros.com/golang-part-1-main-concepts-and-proje ...
- wpf中ListBox的选中项与ComboBox间的绑定
产品类: public class Product:NotificationObject { private int productID; public int ProductID { get { r ...
- ios开发使用lipo命令合并真机库和模拟器库
在开发ios时,我们经常会遇到编译两套库文件,使用模拟器时链接模拟器库,使用真机时使用真机库,这样操作会对后期的维护带来麻烦,所以Apple提供了一个把多个不同平台的.a库文件合并成一个适用于多平台的 ...
- UVA - 11732 "strcmp()" Anyone?左兄弟右儿子trie
input n 2<=n<=4000 s1 s2 ... sn 1<=len(si)<=1000 output 输出用strcmp()两两比较si,sj(i!=j)要比较的次数 ...
- 安卓常用 widget
验证码 public class SpinnerImg extends ImageView { /** * 完成选择后启动另外一个spinner */ private ItemListener ite ...
- map & flatMap 浅析
我之前一直以为我是懂 map 和 flatMap 的.但是直到我看到别人说:「一个实现了 flatMap 方法的类型其实就是 monad.」我又发现这个熟悉的东西变得陌生起来,本节烧脑体操打算更细致一 ...
- 深入解析FileInputStream和FileOutputStream
http://swiftlet.net/archives/1363 FileInputStream和FileOutputStream类属于字节类,可以操作任意类型的文件.在数据流的处理过程中,有两种情 ...
- html base2
<html> <body> <h1>My First Web Page</h1> <p id="demo">A Para ...
- 使用log4j无法输出日志
前段时间在项目的过程中使用log4j来输出日志,但是在一个项目里我明明已经在src/main/resource目录下创建了log4j.properties.具体配置如下: log4j.rootLogg ...