List of usage examples for org.springframework.web.servlet ModelAndView setViewName
public void setViewName(@Nullable String viewName)
From source file:br.com.helio.pocspringmvc.web.ProdutoController.java
@RequestMapping(value = "/add", method = RequestMethod.GET) public ModelAndView add() { ModelAndView modelAndView = new ModelAndView(); modelAndView.addObject("produto", new Produto()); modelAndView.setViewName("produto/add"); return modelAndView; }
From source file:com.neu.edu.servlet.homeController.java
@Override public ModelAndView handleRequest(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception { HttpSession session = hsr.getSession(); String action = hsr.getParameter("action"); ModelAndView mv = new ModelAndView(); if (action.equals("loginpage")) { mv.setViewName("login"); }//from www. ja v a2s . c om else if (action.equals("login")) { String uname = hsr.getParameter("username"); String pass = hsr.getParameter("password"); Customer c = customerDAo.verifyUser(uname, pass); if (c != null) { session.setAttribute("customerId", c.getCustomerID()); session.setAttribute("customerName", c.getName()); mv.setViewName("index"); } else { mv.addObject("error", "true"); mv.setViewName("login"); } } else if (action.equals("logout")) { session.invalidate(); mv.setViewName("index"); } return mv; }
From source file:org.inbio.modeling.web.controller.NewLayerController.java
/** default behavior for direct access (url) */ @Override/*w ww . j a v a 2s .c o m*/ protected ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ModelAndView model = null; // Send the layer list to the JSP model = new ModelAndView(); model.setViewName("admin/layerDetails"); model.addObject("layerForm", new LayerDTO()); return model; }
From source file:org.inbio.modeling.web.controller.NewUserController.java
/** default behavior for direct access (url) */ @Override//from w w w . j a v a2 s . co m protected ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { ModelAndView model = null; // Send the layer list to the JSP model = new ModelAndView(); model.setViewName("admin/userDetails"); model.addObject("userForm", new UserForm()); return model; }
From source file:com.gemtastic.lillakammaren.controller.StoreController.java
@RequestMapping(value = "store/{category}", method = RequestMethod.GET) public ModelAndView category(@PathVariable("category") String category) throws IOException { ModelAndView model = new ModelAndView(); this.repository = ProductRepository.getInstance(); model.setViewName("store"); switch (category) { case "Nyheter": model.addObject("products", repository.getSpecialProduct("Nyheter")); break;//from www . jav a 2 s .com case "REA": model.addObject("products", repository.getSpecialProduct("REA")); break; case "Spotlight": model.addObject("products", repository.getSpecialProduct("Spotlight")); break; default: model.addObject("products", repository.getAllProductsByCategory(category)); break; } model.addObject("categories", repository.getAllCategories()); model.addObject("cartsize", cart.getCartSize()); return model; }
From source file:io.hedwig.petclinic.ui.web.GeneralController.java
@RequestMapping(value = "/unauthorized") public ModelAndView accessDenied() { logger.debug("In accessDenied"); ModelAndView mav = new ModelAndView(); mav.addObject("timestamp", new Date()); mav.setViewName("unauthorized"); return mav;//from w w w . j av a 2 s . c o m }
From source file:com.rr.generic.ui.profile.profileController.java
/** * The 'profile' GET method will return the user profile page. * * @param session/*w w w . j a v a2s. c o m*/ * @return * @throws Exception */ @RequestMapping(value = "", method = RequestMethod.GET) public ModelAndView profile(HttpSession session) throws Exception { ModelAndView mav = new ModelAndView(); mav.setViewName("/profile"); /* Get a list of completed surveys the logged in user has access to */ User userDetails = (User) session.getAttribute("userDetails"); mav.addObject("userDetails", userDetails); return mav; }
From source file:net.cit.tetrad.resource.CommandResource.java
@RequestMapping("/cmdExView.do") public ModelAndView cmdExView(CommonDto dto) throws Exception { log.debug("start - cmdExView()"); ModelAndView mav = new ModelAndView(); mav.setViewName("cmdExView"); log.debug("end - cmdExView()"); return mav;//from w w w . j a v a 2s .c o m }
From source file:com.qq.common.WrappedController.java
@ExceptionHandler(Exception.class) @ResponseBody/*from w w w .ja v a 2 s . com*/ public Object handleException(HttpServletRequest request, Exception e) { boolean isAjax = isAjaxRequest(request); log.info("exception intercepted, uri={}, isajax={}", request.getRequestURI(), isAjax, e); ExceptionResponse response; if (e instanceof CodeEnabled) { CodeEnabled ce = (CodeEnabled) e; response = new ExceptionResponse(EC_INTERNAL_DEFAULT, ce.getFullCode(), ce.getMessageForUser()); } else { response = new ExceptionResponse(EC_INTERNAL_DEFAULT, StringUtils.EMPTY, e.getMessage()); } response.setAttached(new ExceptionResponseAttached().loadFromRequest(request)); if (isAjax) { return response; } else { ModelAndView mv = new ModelAndView(); mv.setViewName("exception"); mv.addObject("response", response); return mv; } }