List of usage examples for org.springframework.web.servlet ModelAndView getModelMap
public ModelMap getModelMap()
From source file:com.zte.gu.webtools.web.rfa.RfaController.java
@RequestMapping(method = RequestMethod.POST) public ModelAndView scan(@RequestParam(required = true) MultipartFile ruFile, HttpSession session) { ModelAndView modelAndView = new ModelAndView("rfa/rfaScan"); if (ruFile.isEmpty()) { modelAndView.getModelMap().addAttribute("error", "RU?"); }//from w w w.j a v a 2 s .c o m if (!ACCEPT_TYPES.contains(ruFile.getContentType())) { modelAndView.getModelMap().addAttribute("error", "RU???"); } InputStream ruInput = null; try { ruInput = ruFile.getInputStream(); File tempZipFile = rfaService.exportXml(ruInput); //? if (tempZipFile != null) { session.setAttribute("filePath", tempZipFile.getPath()); session.setAttribute("fileName", "rfa.zip"); modelAndView.setViewName("redirect:/download"); } } catch (Exception e) { LoggerFactory.getLogger(RfaController.class).warn("download error,", e); modelAndView.getModelMap().addAttribute("error", "?" + e.getMessage()); } finally { IOUtils.closeQuietly(ruInput); } return modelAndView; }
From source file:gov.nih.nci.cabig.caaers.web.participant.ViewParticipantController.java
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { String type = ServletRequestUtils.getStringParameter(request, "type"); // request.getParameter("type"); String msg = "You have successfully created a new subject."; setViewName("par/par_view"); Participant participant = participantDao.getById(Integer.parseInt(request.getParameter("participantId"))); ////w ww. j a va2 s. c o m ParticipantInputCommand cmd = new EditParticipantCommand(participant); List<StudyParticipantAssignment> assignments = participant.getAssignments(); // store StudySites from Participant object to Command object List<StudySite> studySites = new ArrayList<StudySite>(); for (StudyParticipantAssignment studyParticipantAssignment : assignments) { studySites.add(studyParticipantAssignment.getStudySite()); } cmd.setStudySites(studySites); if (participant.getAssignments().size() > 0) cmd.setOrganization(participant.getAssignments().get(0).getStudySite().getOrganization()); // ModelAndView mav = new ModelAndView("par/par_view", "participant", participant); mav.getModelMap().addObject("command", cmd); if (type != null) if (type.equals(TYPE_EDIT)) msg = "You have successfully updated the subject."; mav.getModel().put("flashMessage", msg); return mav; }
From source file:nl.surfnet.coin.selfservice.interceptor.MenuInterceptor.java
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if (modelAndView != null) { final ModelMap map = modelAndView.getModelMap(); Menu menu = createMenu(); setSelected(request, menu);/*from w w w . ja va2 s . c o m*/ map.addAttribute("menu", menu); } }
From source file:com.klm.workshop.controller.AuthController.java
/** * Lets anonymous clients sign up//from w w w .j a v a2 s . c o m * * @param model Autowired model and view * @return Sign up view */ @RequestMapping(value = "/sign-up", method = RequestMethod.GET) public ModelAndView getSignUp(ModelAndView model) { model.setViewName("auth/sign_up"); model.getModelMap().addAttribute("account", new SignUpValidator()); return model; }
From source file:abm.jakaria.school.ResultController.java
@RequestMapping(value = "/saveResult", method = RequestMethod.GET) public ModelAndView newuserForm() { ModelAndView mav = new ModelAndView("newResult"); Result result = new Result(); mav.getModelMap().put("newResult", result); return mav;//from w w w .ja v a 2 s.c o m }
From source file:nl.surfnet.coin.selfservice.control.LogoutControllerTest.java
@Test public void testLogout() throws Exception { SessionStatus status = new SimpleSessionStatus(); final ModelAndView modelAndView = controller.logout(new MockHttpServletRequest(), status); assertEquals("logout", modelAndView.getViewName()); assertTrue(modelAndView.getModelMap().isEmpty()); }
From source file:abm.jakaria.school.StudentController.java
@RequestMapping(value = "/saveStudent", method = RequestMethod.GET) public ModelAndView newuserForm() { ModelAndView mav = new ModelAndView("newStudent"); Student student = new Student(); mav.getModelMap().put("newStudent", student); return mav;/* w w w .j a v a2 s.c o m*/ }
From source file:abm.jakaria.school.EmployeeController.java
@RequestMapping(value = "/saveEmployee", method = RequestMethod.GET) public ModelAndView newuserForm() { ModelAndView mav = new ModelAndView("newEmployee"); Employee employee = new Employee(); mav.getModelMap().put("newEmployee", employee); return mav;/*from w w w. ja v a2s . co m*/ }
From source file:abm.jakaria.school.CommiteeController.java
@RequestMapping(value = "/saveCommitee", method = RequestMethod.GET) public ModelAndView newuserForm() { ModelAndView mav = new ModelAndView("newCommitee"); Commitee commitee = new Commitee(); mav.getModelMap().put("newCommitee", commitee); return mav;//from w w w . j a v a2s .co m }
From source file:abm.jakaria.school.ContractusController.java
@RequestMapping(value = "/saveContractus", method = RequestMethod.GET) public ModelAndView newuserForm() { ModelAndView mav = new ModelAndView("newContractus"); Contractus contractus = new Contractus(); mav.getModelMap().put("newContractus", contractus); return mav;/* w w w. j a v a 2 s.co m*/ }