List of usage examples for org.springframework.web.servlet ModelAndView addObject
public ModelAndView addObject(String attributeName, @Nullable Object attributeValue)
From source file:ua.aits.oblenergo_site.controller.SystemController.java
@RequestMapping(value = { "/system/index", "/system/main", "/system/home" }, method = RequestMethod.GET) public ModelAndView index(HttpServletRequest request, HttpServletResponse response) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, ParseException { ModelAndView model = new ModelAndView("/system/index"); model.addObject("menuList", Helpers.getRowHtmlList("ua", "0")); return model; }
From source file:ua.aits.oblenergo_site.controller.SystemController.java
@RequestMapping(value = { "/system/users", "/system/users/" }, method = RequestMethod.GET) public ModelAndView users(HttpServletRequest request, HttpServletResponse response) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, ParseException { ModelAndView model = new ModelAndView("/system/users"); model.addObject("users", Users.getAllUsers()); return model; }
From source file:web.SecurityController.java
@RequestMapping(value = "/login", method = RequestMethod.GET) public ModelAndView login(@RequestParam(value = "error", required = false) String error, @RequestParam(value = "logout", required = false) String logout) { ModelAndView model = new ModelAndView(); if (error != null) { model.addObject("error", "Invalid username and password!"); }/*from w w w .j ava 2s . c o m*/ if (logout != null) { model.addObject("msg", "You've been logged out successfully."); } model.setViewName("login"); return model; }
From source file:no.dusken.aranea.control.SearchController.java
@Override protected ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object o, BindException e) throws Exception { CompassSearchCommand searchCommand = (CompassSearchCommand) o; setType("page"); StringBuilder tempExtra = new StringBuilder(); if (onlyPublished != null && onlyPublished) tempExtra.append(" AND published:(true)"); setExtraQueryPart(tempExtra.toString()); ModelAndView mav = super.handle(request, response, searchCommand, e); mav.addObject("pdfDirectory", pdfDirectory); return mav;// w w w . jav a 2 s.c om }
From source file:no.dusken.momus.exceptions.ExceptionHandler.java
@Override public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse response, Object o, Exception e) { if (e instanceof RestException) { // If it's our exception, we know how to handle it and has set a status response.setStatus(((RestException) e).getStatus()); } else if (e instanceof AccessDeniedException) { // let Spring handle it by throwing it again throw (AccessDeniedException) e; } else if (e instanceof AuthenticationException) { // let Spring handle it, is a failed login throw (AuthenticationException) e; } else { // Something else, log it and set status to internal server error response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); logException(e);/*ww w .j ava 2 s.c o m*/ } ModelAndView mav = new ModelAndView(new MappingJackson2JsonView()); mav.addObject("error", e.getMessage()); return mav; }
From source file:org.mifos.ui.core.controller.GenericController.java
@Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { Map<String, Object> model = new HashMap<String, Object>(); model.put("request", request); Map<String, Object> status = new HashMap<String, Object>(); List<String> errorMessages = new ArrayList<String>(); status.put("errorMessages", errorMessages); ModelAndView modelAndView = new ModelAndView(getPageToDisplay(request), "model", model); modelAndView.addObject("status", status); return modelAndView; }
From source file:com.castlemock.web.basis.web.mvc.controller.project.UpdateProjectController.java
/** * Retrieves a specific project and creates a view that displays it to the user. * The user is allowed to modify certain attributes of the project. The modified * values might later be used to update the project attributes. * @param projectType The type of the project * @param projectId The id of the project that will be retrieved and displayed * @return A view that displays the retrieved project. *//*from w w w . j a v a2 s .c om*/ @PreAuthorize("hasAuthority('MODIFIER') or hasAuthority('ADMIN')") @RequestMapping(value = "{projectType}/project/{projectId}/update", method = RequestMethod.GET) public ModelAndView defaultPage(@PathVariable final String projectType, @PathVariable final String projectId) { final ProjectDto projectDto = projectServiceComponent.findOne(projectType, projectId); final ModelAndView model = createPartialModelAndView(PAGE); model.addObject(PROJECT, projectDto); return model; }
From source file:com.library.bookarticlelibrary.controller.BooksController.java
@RequestMapping(value = "/books/addbook", method = RequestMethod.GET) public ModelAndView displayAddBook() { ModelAndView model = new ModelAndView("addbook"); model.addObject("title", "Books"); model.addObject("book", new Book()); return model; }
From source file:CRM.web.MishaSecurityController.java
@RequestMapping(value = "/login", method = RequestMethod.GET) public ModelAndView login(@RequestParam(value = "error", required = false) String error, @RequestParam(value = "logout", required = false) String logout) { ModelAndView model = new ModelAndView(); if (error != null) { model.addObject("error", "Invalid username and password!"); }/*from w w w. j a va2 s. co m*/ if (logout != null) { model.addObject("msg", "You have successfully logged out."); } model.setViewName("login"); return model; }
From source file:de.chludwig.websec.saml2sp.controller.Saml2SPErrorController.java
@RequestMapping(ERROR_PAGE_PATH) public ModelAndView errorPage(HttpServletRequest request, HttpServletResponse response, @CurrentUser ApplicationUser currentUser) { ModelAndView modelAndView = Saml2SpController.createModelAndView("error", currentUser); modelAndView.addObject("forwardedFrom", request.getAttribute("javax.servlet.forward.request_uri")); modelAndView.addObject("statusCode", response.getStatus()); return modelAndView; }