spring mvc中controller怎么接受页面表单提交的数据
来源:互联网 发布:jsp引入js 编辑:程序博客网 时间:2024/06/06 08:32
spring mvc controller 接受表单提交的表单有四种方式:
1、@RequestParam
@RequestMapping(value=”/xxx.do”)
public void create(@RequestParam(value=”userName”)String userName)throw Exception{
}
2、@PathVariable
@RequestMapping(value=”/{groupid}.do”){
gourpRepository.selectOne(groupId);
}
3、@ModelAttribute
@RequestMapping(value=”/xxx.do”)
public String create(@ModelAttribute User user)throws Exception{
userService.insert(user);
return “redirect:/user/create.do”
}
4、Request对象
public ModelAndView method(HttpServkletRequest request,HttpServletReponse)throws ServletExeception,IOException{
Map model = new HashMap();
model.put(“message”,”你调用的方法是1”);
return new ModelAndView(“/index.sjp”,”model”,model);
}
转自
阅读全文
0 0
- spring mvc中controller怎么接受页面表单提交的数据
- spring mvc中controller怎么接收页面表单提交的数据
- spring mvc中controller怎么接收页面表单提交的数据
- Spring MVC中Controller如何获取Form表单提交的数据
- Spring mvc中把表单数据当做一个对象提交给controller的实现
- spring mvc 文件上传 controller中接收form表单中提交上来的文件
- Spring Mvc 表单数据与Controller中模型(Model)的映射
- Spring MVC中Controller如何将数据返回给页面
- spring mvc在注解开发下表单提交到不了Controller方法的解决手段
- asp.net MVC中form提交和控制器接受form提交过来的数据
- asp.net MVC中form提交和控制器接受form提交过来的数据
- asp.net MVC中form提交和控制器接受form提交过来的数据
- asp.net MVC中form提交和控制器接受form提交过来的数据
- Spring MVC 表单提交中需注意的问题
- Spring MVC接受JSON格式的数据
- Spring MVC接受JSON格式的数据
- Spring MVC接受XML格式的数据
- Spring MVC接受XML格式的数据
- springmvc核心之HandlerMethodReturnValueHandler
- C#面向对象——继承
- struts2---The content of element type "package" must match "(result-types?,interceptors?,default-int
- 在win7环境下安装centos遇到的问题
- HashMap
- spring mvc中controller怎么接受页面表单提交的数据
- 学习日志2015.12.15
- 人工智能学习笔记--专业词汇
- 又有程序员跳楼了 我们是有多累?
- win10企业版激活
- 教主的魔法 bzoj3343 分块
- Python---一门很厉害的语言
- MySQL
- Windows常用快捷键总结