参数封装:
命令控制器
request预处理
inibinder
注解开发
requestMapping(“hello”)
requestMapping(“/hello.do”)
requestMapping(value=”/hello.do”)
requestMapping(value=”/hello.do”,method=RequestMethod.GET)
requestMapping(value=”/hello.do”,method=RequestMethod.POST)
浏览器直接访问,a标签都是get请求
表单提交(指定post),ajax指定post提交,post提交。
requestMapping(value=”/hello.do”,method={RequestMethod.POST, RequestMethod.GET})
RequestMaping根路径
@RequestMapping(”/user”)
UserController{
requestMapping(“save”)
Save()
requestMapping(“update”)
Update{}
requestMapping(“find”)
Fiind()
}
项目名/user/save.do
@RequestMapping(”/items”)
ItemsController{
requestMapping(“save”)
Save()
requestMapping(“update”)
Update{}
requestMapping(“find”)
Fiind()
}
项目名/items/save.do
参数封装
分析接受参数类型:
基本类型,int,String等等基本类型。
Pojo类型
包装类型
数组类型
Springmvc默认支持类型:
HttpSession,HttpRequstServlet,Model等等。
springmvc中没有成员变量
所以当请求与页面时这个方法内对象会被自动创建和输入参数
但是要求前端表单元素name和输入参数名称相同
传list集合
后端使用包装类:
userCustom{
private user user;
private List<User> userList;
private Map<K,V> maps;
private items items;
}
传map
参数回显
URL模板映射
restfull