1、知识点:
    1)、在重定向到其他controller中的方法的时候,只要保证两者的参数名一致即可实现数据的传递。
    2)、 mv.setViewName("redirect:other.do"); 使用重定向到其他Controller的other.do,此时springmvc.xml配置文件中的视图解析器将会失效

    1. @RequestMapping("/redirectMAV.do")
    2. public ModelAndView redirectMAV(School school,String name)throws Exception{
    3. ModelAndView mv = new ModelAndView();
    4. mv.addObject("name", name);
    5. mv.addObject("schoolName", school.getSchoolName());
    6. mv.addObject("address", school.getAddress());
    7. System.out.println(school.getAddress());
    8. //使用重定向,此时springmvc.xml配置文件中的视图解析器将会失效
    9. mv.setViewName("redirect:other.do");
    10. return mv;
    11. }
    1. RequestMapping("/other.do")
    2. public ModelAndView other(String name, School school)throws Exception{
    3. ModelAndView mv = new ModelAndView();
    4. //单个接收
    5. mv.addObject("name", name);
    6. //通过javabean对象接收
    7. mv.addObject("school", school);
    8. System.out.println(school.getAddress());
    9. mv.setViewName("result");
    10. return mv;
    11. }