1、多个参数传值
******前端**********
<input type="text" name="myName"/>
<input type="text" name="age"/>
.........
******后端1(相同属性名)**********
@Controller
public class A{
@RequestMapping(value="/uri")
public ModelAndView test(String myName,Inteage age){
return modelandview;
}
}
******后端2(自定义属性名)**********
@Controller
public class A{
@RequestMapping(value="/uri")
public ModelAndView test(@RequestParam(value="myName")String name,Inteage age){
return modelandview;
}
}
******后端3(属性名可为空)**********
@Controller
public class A{
@RequestMapping(value="/uri")
public ModelAndView test(@RequestParam(value="myName",required=false)String name,Inteage age){
return modelandview;
}
}
******后端4(接收为对象)**********
@Controller
public class A{
@RequestMapping(value="/uri")
public ModelAndView test(Student stu){
return modelandview;
}
}
class Student{
private String name;
private Inteager age;
}