@RequestMapping("/import")
@ResponseBody
public ModelAndView importFile(@RequestParam(value="uploadFile")MultipartFile mFile,
HttpServletRequest request, ModelMap map,HttpServletResponse response,HttpSession session){
ModelAndView mav=new ModelAndView();
String rootPath = request.getSession().getServletContext().getRealPath(File.separator);
List<StudentInfo> studentInfo = ieportService.importFile(mFile, rootPath,session);
int insertedNum=studentInfo.size();
//mav.setViewName("signup");
mav.setViewName("redirect:/signup.jsp");
mav.addObject("insertedNum", insertedNum);
return mav;
}
后台运行后返回页面地址为:
http://localhost:8080/signupSystem/signup.jsp?insertedNum=1
前台获取值方式是:” param.insertedNum",而不是在一般情况下的" {insertedNum}”