List of usage examples for org.springframework.web.servlet ModelAndView addObject
public ModelAndView addObject(String attributeName, @Nullable Object attributeValue)
From source file:br.com.alura.casadocodigo.controllers.ProdutosController.java
@RequestMapping(method = RequestMethod.GET) public ModelAndView listar() { List<Produto> produtos = produtoDAO.listar(); ModelAndView modelAndView = new ModelAndView("produtos/lista"); modelAndView.addObject("produtos", produtos); return modelAndView; }
From source file:com.castlemock.web.mock.rest.web.mvc.controller.mockresponse.CreateRestMockResponseController.java
@PreAuthorize("hasAuthority('READER') or hasAuthority('MODIFIER') or hasAuthority('ADMIN')") @RequestMapping(value = "/{restProjectId}/application/{restApplicationId}/resource/{restResourceId}/method/{restMethodId}/create/response", method = RequestMethod.GET) public ModelAndView displayCreatePage(@PathVariable final String restProjectId, @PathVariable final String restApplicationId, @PathVariable final String restResourceId, @PathVariable final String restMethodId) { final ReadRestMethodOutput output = serviceProcessor .process(new ReadRestMethodInput(restProjectId, restApplicationId, restResourceId, restMethodId)); final RestMockResponseDto mockResponse = new RestMockResponseDto(); mockResponse.setBody(output.getRestMethod().getDefaultBody()); mockResponse.setHttpStatusCode(DEFAULT_HTTP_STATUS_CODE); final ModelAndView model = createPartialModelAndView(PAGE); model.addObject(REST_PROJECT_ID, restProjectId); model.addObject(REST_APPLICATION_ID, restApplicationId); model.addObject(REST_RESOURCE_ID, restResourceId); model.addObject(REST_METHOD_ID, restMethodId); model.addObject(REST_MOCK_RESPONSE, mockResponse); model.addObject(REST_MOCK_RESPONSE_STATUSES, RestMockResponseStatus.values()); return model; }
From source file:com.castlemock.web.mock.soap.web.mvc.controller.port.DeleteSoapPortController.java
/** * Returns the port that should be deleted and display it on a confirmation page * @param soapProjectId The id of the project which the port belongs to * @param soapPortId The id of the port that should be returned * @return Returns an port that matches the incoming parameters (soapProjectId and soapPortId) *//*from ww w .j ava2s . c om*/ @PreAuthorize("hasAuthority('MODIFIER') or hasAuthority('ADMIN')") @RequestMapping(value = "/{soapProjectId}/port/{soapPortId}/delete", method = RequestMethod.GET) public ModelAndView showConfirmationPage(@PathVariable final String soapProjectId, @PathVariable final String soapPortId) { final ReadSoapPortOutput output = serviceProcessor .process(new ReadSoapPortInput(soapProjectId, soapPortId)); ModelAndView model = createPartialModelAndView(PAGE); model.addObject(SOAP_PROJECT_ID, soapProjectId); model.addObject(SOAP_PORT, output.getSoapPort()); return model; }
From source file:com.trenako.web.controllers.YouController.java
@RequestMapping(method = RequestMethod.GET) public ModelAndView index() { Account user = UserContext.authenticatedUser(secContext); ModelAndView mav = new ModelAndView("you/index"); mav.addObject("user", user); mav.addObject("info", service.findProfileView(user)); return mav;/* w w w . ja va 2s . c om*/ }
From source file:se.vgregion.mobile.controllers.AdminGuiController.java
@RequestMapping(value = "/admin", method = RequestMethod.GET) public ModelAndView index(HttpServletRequest request) throws IOException { ModelAndView mav = new ModelAndView("admin/index"); mav.addObject("appurl", getApplicationUrl(request)); mav.addObject("printers", printerService.findAllPrinters()); return mav;//ww w .java 2s. c o m }
From source file:controller.makeAppointment.java
@RequestMapping(method = RequestMethod.GET) public ModelAndView makeAppointment() { ModelAndView modelAndView = new ModelAndView("makeAppointment", "makeAppointment", new Appointment1()); modelAndView.addObject("patients", service.getPatients()); modelAndView.addObject("doctors", service.getDoctors()); return modelAndView; }
From source file:ru.langboost.controllers.security.SecurityController.java
@RequestMapping(value = "/login", method = RequestMethod.GET) public ModelAndView login() { ModelAndView model = new ModelAndView(); model.addObject("credentials", new Credentials()); model.setViewName("security/login"); return model; }
From source file:ru.langboost.controllers.security.SecurityController.java
@RequestMapping(value = "/registration", method = RequestMethod.GET) public ModelAndView registration() { ModelAndView model = new ModelAndView(); model.addObject("roles", Arrays.asList(Roles.values())); model.setViewName("security/registration"); return model; }
From source file:ash.resourcemanager.spring.controllers.ProjectsController.java
@RequestMapping(value = "/projects", method = RequestMethod.GET) public ModelAndView showProjects() { List<Project> projects = getProjectsDAO().getAll(); ModelAndView modelAndView = new ModelAndView("projects"); modelAndView.addObject("projects", projects); return modelAndView; }
From source file:com.infinity.controller.CommentsController.java
@RequestMapping(value = { "/comments/get/{id}" }, method = RequestMethod.GET) public ModelAndView getComments(@PathVariable String id) throws IOException { Comments byId = commentsService.getById(id); ModelAndView mv = new ModelAndView("comments"); mv.addObject("comments", byId); return mv;/*from ww w . j a v a2 s . co m*/ }