1、多个参数传值

    1. ******前端**********
    2. <input type="text" name="myName"/>
    3. <input type="text" name="age"/>
    4. .........
    5. ******后端1(相同属性名)**********
    6. @Controller
    7. public class A{
    8. @RequestMapping(value="/uri")
    9. public ModelAndView test(String myName,Inteage age){
    10. return modelandview;
    11. }
    12. }
    13. ******后端2(自定义属性名)**********
    14. @Controller
    15. public class A{
    16. @RequestMapping(value="/uri")
    17. public ModelAndView test(@RequestParam(value="myName")String name,Inteage age){
    18. return modelandview;
    19. }
    20. }
    21. ******后端3(属性名可为空)**********
    22. @Controller
    23. public class A{
    24. @RequestMapping(value="/uri")
    25. public ModelAndView test(@RequestParam(value="myName",required=false)String name,Inteage age){
    26. return modelandview;
    27. }
    28. }
    29. ******后端4(接收为对象)**********
    30. @Controller
    31. public class A{
    32. @RequestMapping(value="/uri")
    33. public ModelAndView test(Student stu){
    34. return modelandview;
    35. }
    36. }
    37. class Student{
    38. private String name;
    39. private Inteager age;
    40. }