springMVC接受表单数据
2015-07-02 13:22
591 查看
1.@RequestParam
[java] view
plaincopyprint?
@RequestMapping(value = "/xxxx.do")
public void create(@RequestParam(value="userName") String userName) throws Exception {
}
2.@PathVariable
[java] view
plaincopyprint?
@RequestMapping(value="/{groupId}.do")
public void detail(@PathVariable long groupId){
groupRepository.selectOne(groupId);
}
3.@ModelAttribute
[java] view
plaincopyprint?
@RequestMapping(value = "/xxxx.do")
public String create(@ModelAttribute User user) throws Exception {
userService.insert(user);
return "redirect:/user/create.do";
}
4.Request对象
[java] view
plaincopyprint?
public ModelAndView method1(HttpServletRequest request,
HttpServletResponse respnose) throws ServletException, IOException {
Map model = new HashMap();
model.put("message", "你调用的是方法1");
[java] view
plaincopyprint?
@RequestMapping(value = "/xxxx.do")
public void create(@RequestParam(value="userName") String userName) throws Exception {
}
2.@PathVariable
[java] view
plaincopyprint?
@RequestMapping(value="/{groupId}.do")
public void detail(@PathVariable long groupId){
groupRepository.selectOne(groupId);
}
3.@ModelAttribute
[java] view
plaincopyprint?
@RequestMapping(value = "/xxxx.do")
public String create(@ModelAttribute User user) throws Exception {
userService.insert(user);
return "redirect:/user/create.do";
}
4.Request对象
[java] view
plaincopyprint?
public ModelAndView method1(HttpServletRequest request,
HttpServletResponse respnose) throws ServletException, IOException {
Map model = new HashMap();
model.put("message", "你调用的是方法1");
相关文章推荐
- java总结(之二)--容器的深入研究
- javax.persistence.EntityNotFoundException: Unable to find XXXX with id 0 问题原因
- Android Studio导入eclipse工程(引用多个其它工程)
- java 防止xss攻击 通过filter的方法(推荐)
- [Java]单向链表 ,循环链表的简单使用方法
- [Java] LinkedList 的简单使用方法
- Java GC基本算法
- java中&&和&和||和|详解
- springmvc+mybatis+spring
- java中判断字符串是否为数字的方法的几种方法
- Java正则去除文本中的HTML标签
- 已经安装了Myeclipse8.5 的情况下,激活myeclipse10.7要注意
- eclipse下使用cygwin的方法(Windows下用eclipse玩gcc/g++和gdb)
- struts2的核心和工作原理
- 使用springMVC的详细步骤
- 文件的输出与载入之java操作
- myeclipse关闭html,jsp等页面的可视化编辑器
- Java enum的用法详解
- Struts2的几个核心类
- Java的堆(Heap)和栈(Stack)的区别