List of usage examples for org.springframework.web.servlet ModelAndView setViewName
public void setViewName(@Nullable String viewName)
From source file:com.work.petclinic.web.GeneralController.java
@ExceptionHandler(Exception.class) public ModelAndView handleException(HttpServletRequest req, Exception e) { log.warn("In handleException", e); ModelAndView mav = new ModelAndView(); mav.addObject("exception", e); mav.addObject("timestamp", new Date()); mav.addObject("url", req.getRequestURL()); mav.setViewName("exception"); return mav;//w w w . j a v a 2s . c om }
From source file:com.bsb.cms.moss.controller.login.LoginController.java
/** * ?//from w w w . j a v a2s .com * * @return * @throws Exception */ @RequestMapping(URL_LOGIN_INDEX) public ModelAndView index() throws Exception { ModelAndView mav = new ModelAndView(); mav.setViewName(VIEW_LOGIN); return mav; }
From source file:com.bsb.cms.moss.controller.login.LoginController.java
/** * ??/*from w w w . ja va2 s .co m*/ * * @return */ @RequestMapping(URL_LOGIN_SUCC) public ModelAndView toMain() { ModelAndView mav = new ModelAndView(); mav.setViewName(VIEW_MAIN); return mav; }
From source file:com.rr.wabshs.ui.resources.resourcesController.java
@RequestMapping(value = "", method = RequestMethod.GET) public ModelAndView resourcesList(HttpSession session) throws Exception { /* Get a list of completed surveys the logged in user has access to */ User userDetails = (User) session.getAttribute("userDetails"); ModelAndView mav = new ModelAndView(); mav.setViewName("/resources/users"); /* Get a list of top level entities */ Integer userId = 0;//from ww w .ja va 2 s .c o m if (userDetails.getRoleId() == 3) { userId = userDetails.getId(); } /* Get a list of available program resources */ List<programResources> programResources = resourceManager.getResources(programId); mav.addObject("programResources", programResources); boolean allowResourceAdmin = false; if (userDetails.getRoleId() == 2) { allowResourceAdmin = true; } mav.addObject("allowResourceAdmin", allowResourceAdmin); return mav; }
From source file:edu.lfa.df.controller.MainController.java
@RequestMapping(value = { "/", "/welcome/**" }, method = RequestMethod.GET) public ModelAndView defaultPage() { ModelAndView model = new ModelAndView(); model.addObject("title", "Spring Security Login Form - Database Authentication"); model.addObject("message", "This is default page!"); model.setViewName("hello"); return model; }
From source file:com.controller.RegistrarController.java
@RequestMapping("registrar.htm") public ModelAndView Registrar() { ModelAndView mav = new ModelAndView(); mav.setViewName("telefonos/registrar"); return mav;//from w ww . ja v a2s.c om }
From source file:com.persistent.cloudninja.controller.RunningInstancesJSONDataController.java
/** * Gets the instance count to be displayed on graph. * @param request the Http request//w w w . ja v a 2 s . co m * @param response the Http response * @return ModelAndView corresponding to roleKpiListJSON view */ @RequestMapping("/getInstanceChartData.htm") public ModelAndView healthPage(HttpServletRequest request, HttpServletResponse response) { String yearStr = request.getParameter("year"); String monthStr = request.getParameter("month"); List<String> errors = new ArrayList<String>(); if ((yearStr == null) || (yearStr.trim().length() == 0)) { errors.add("year is required"); } else if ((monthStr == null) || (monthStr.trim().length() == 0)) { errors.add("month is required"); } ModelAndView modelAndView = new ModelAndView(); if (errors.size() > 0) { modelAndView.setViewName("jsonErrorPage"); modelAndView.addObject("errorList", errors); } else { int year = Integer.parseInt(yearStr); int month = Integer.parseInt(monthStr); String callback = request.getParameter("callback"); List<String> startAndEndtime = generateStartAndEndTime(year, month); RunningInstanceDTO runningInstanceDTO = new RunningInstanceDTO(); runningInstanceDTO = runningInstancesJSONDataService.getRunningInstances(startAndEndtime.get(0), startAndEndtime.get(1)); modelAndView.setViewName("runningInstanceChartData"); modelAndView.addObject("runningInstanceDTO", runningInstanceDTO); modelAndView.addObject("callback", callback); } return modelAndView; }
From source file:io.hedwig.petclinic.ui.web.GeneralController.java
@ExceptionHandler(Exception.class) public ModelAndView handleException(HttpServletRequest req, Exception e) { logger.debug("In handleException"); ModelAndView mav = new ModelAndView(); mav.addObject("exception", e); mav.addObject("timestamp", new Date()); mav.addObject("url", req.getRequestURL()); mav.setViewName("exception"); return mav;/* ww w .j a v a2s. c o m*/ }
From source file:org.myjerry.evenstar.web.feed.FeedController.java
private ModelAndView getModelAndView(String feedContents) { ModelAndView mav = new ModelAndView(); mav.addObject("contents", feedContents); mav.setViewName(".feed.output"); return mav;//from w w w .ja v a 2 s .c o m }
From source file:com.klm.workshop.controller.host.manage.WorkshopController.java
/** * Show create workshops form//from www . j a v a 2 s. co m * * @param model Objects and view * @return Form to create a workshop */ @RequestMapping(value = "/workshops/create", method = RequestMethod.GET) public ModelAndView getCreate(ModelAndView model) { model.addObject("workshop", new Workshop()); model.setViewName("host/manage/workshops/create"); return model; }