List of usage examples for org.springframework.web.servlet ModelAndView addObject
public ModelAndView addObject(String attributeName, @Nullable Object attributeValue)
From source file:eventmanager.controller.ConfigController.java
@RequestMapping(value = "/User/config") public ModelAndView config(HttpSession session) { ModelAndView modelAndView = new ModelAndView("index"); User user = (User) session.getAttribute("usuario_logado"); modelAndView.addObject("usuario", user.getNome()); modelAndView.addObject("link", true); modelAndView.addObject("nomeEvento", new Busca()); return RenderView.getInstance().renderConfigViewUser(user, modelAndView); }
From source file:org.openmrs.module.healthassignment.web.controller.MyFirstMavenModuleManageController.java
@RequestMapping(value = "/module/healthassignment/summary", method = RequestMethod.GET) public ModelAndView displaySummary(@RequestParam(value = "id", required = false) int id) { ModelAndView model = new ModelAndView(); model.addObject("patientName", Context.getPatientService().getPatient(id)); model.addObject("detail", Context.getEncounterService().getEncountersByPatient(Context.getPatientService().getPatient(id))); //model.setViewName("manage"); return model; }
From source file:protocolo.controller.IndexController.java
@RequestMapping(value = "/") ModelAndView index() {//from w w w . jav a2 s . c om ModelAndView modelAndView = new ModelAndView("index"); SimpleDateFormat date = new SimpleDateFormat("dd/MM/yyyy"); modelAndView.addObject("codigo", new Codigo()); modelAndView.addObject("data", date.format(new Date())); return modelAndView; }
From source file:ua.aits.oblenergo_site.controller.SystemController.java
@RequestMapping(value = { "/system/users/edit/{id}", "/system/users/edit/{id}/", "/Carpath/system/users/edit/{id}", "/Carpath/system/users/edit/{id}/" }) public ModelAndView editUser(@PathVariable("id") String id, HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView modelAndView = new ModelAndView("/system/users_edit"); modelAndView.addObject("user", Users.getOneUserFullById(id)); return modelAndView; }
From source file:com.castlemock.web.mock.rest.web.mvc.controller.mockresponse.DeleteRestMockResponseController.java
@PreAuthorize("hasAuthority('MODIFIER') or hasAuthority('ADMIN')") @RequestMapping(value = "/{restProjectId}/application/{restApplicationId}/resource/{restResourceId}/method/{restMethodId}/response/{restMockResponseId}/delete", method = RequestMethod.GET) public ModelAndView showConfirmationPage(@PathVariable final String restProjectId, @PathVariable final String restApplicationId, @PathVariable final String restResourceId, @PathVariable final String restMethodId, @PathVariable final String restMockResponseId) { final ReadRestMockResponseOutput output = serviceProcessor.process(new ReadRestMockResponseInput( restProjectId, restApplicationId, restResourceId, restMethodId, restMockResponseId)); 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, output.getRestMockResponse()); return model; }
From source file:com.translationexchange.samples.spring.boot.welp.controllers.HomeController.java
@RequestMapping(value = "/", method = RequestMethod.GET) public ModelAndView index(ModelMap modelMap, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ModelAndView model = new ModelAndView(); model.setViewName("index"); model.addObject("restaurants", Utils.buildList(/*from ww w. j a v a 2s. c om*/ Utils.buildMap("name", "Ricky's Fish Tacos", "rating", 4, "review_count", 14, "last_comment", "Luckily, the perfect hot day food is a fish taco."), Utils.buildMap("name", "Genwa Korean Bbq", "rating", 3, "review_count", 567, "last_comment", "I love love love the fact that you get 25 side dishes."), Utils.buildMap("name", "Kang Hodong Baekjeong", "rating", 2, "review_count", 1, "last_comment", "Thick slices of juicy pastrami on rye hits the spot every time."), Utils.buildMap("name", "Guisados", "rating", 1, "review_count", 12, "last_comment", "I can't wait to introduce more people to these orgasmic tacos."))); return model; }
From source file:controller.Crud.java
@RequestMapping(value = "/tambahdata", method = RequestMethod.POST) public ModelAndView simpan(@Valid @ModelAttribute("hallo") Hallo hallo, BindingResult result) { if (result.hasErrors()) { ModelAndView modelAndView = new ModelAndView("crud/tambah"); modelAndView.addObject("command", new Hallo()); modelAndView.addObject("error", result.getAllErrors()); return modelAndView; } else {// w w w . ja va2 s. c om config.tambahData(hallo); return new ModelAndView("redirect:show"); } }
From source file:controller.Crud.java
@RequestMapping(value = "/edit/{id}", method = RequestMethod.POST) public ModelAndView update(@Valid @ModelAttribute("hallo") Hallo hallo, BindingResult result, @PathVariable("id") String id) { if (result.hasErrors()) { ModelAndView modelAndView = new ModelAndView("crud/edit"); modelAndView.addObject("command", hallo); modelAndView.addObject("id", id); modelAndView.addObject("error", result.getAllErrors()); return modelAndView; } else {/* w ww .j av a2 s . co m*/ config.simpanUpdate(hallo); return new ModelAndView("redirect:/show"); } }
From source file:ua.aits.oblenergo_site.controller.SystemController.java
@RequestMapping(value = { "/system/users/delete/{id}", "/system/users/delete/{id}/" }) public ModelAndView deleteUser(@PathVariable("id") String id, HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView modelAndView = new ModelAndView("/system/users_delete"); modelAndView.addObject("user", Users.getOneUserFullById(id)); return modelAndView; }
From source file:elekto.results.ResultsController.java
@RequestMapping(value = "/elections-model.xls", method = GET) public ModelAndView modeleExcelFile(final HttpServletResponse response) { final ModelAndView modelAndView = new ModelAndView("classpathResourceView"); modelAndView.addObject(ClasspathResourceView.CONTENT_TYPE_MODEL_KEY, "application/vnd.ms-excel"); modelAndView.addObject(ClasspathResourceView.CLASSPATH_RESOURCE_MODEL_KEY, "/elections-template.xls"); return modelAndView; }