List of usage examples for org.springframework.web.servlet ModelAndView addObject
public ModelAndView addObject(String attributeName, @Nullable Object attributeValue)
From source file:org.fon.documentmanagementsystem.controllers.PodsistemController.java
@RequestMapping(path = "/details/{id}", method = RequestMethod.GET) public ModelAndView showSubsystem(@PathVariable("id") long id) { Podsistem podsistem = podsistemService.findOne(id); // if (podsistem == null) throw new CustomException("There is no company with id " + id, "404"); // List<User> usersOfCompany = userService.findUsersOfCompany(company); // System.out.println("@@@@@@@@@@@ " + usersOfCompany); ModelAndView mv = new ModelAndView("subsystem_add"); mv.addObject("subsystem", podsistem); // mv.addObject("users", usersOfCompany); return mv;//from w w w . jav a2 s . co m }
From source file:sample.data.jpa.web.InventoryController.java
/** * Controller to save the order and then list previous history * @param source - source of the inventory * @param destination - destination of the inventory *//*from www.j a va 2 s . c om*/ @RequestMapping(value = "/saveOrder", method = RequestMethod.POST) public ModelAndView saveInventory(String source, String destination) { InventoryDTO inventoryDto = new InventoryDTO(); inventoryDto.setDestination(destination); inventoryDto.setSource(source); this.inventoryService.saveOrder(inventoryDto); // View all order history List<Inventory> inventorys = this.inventoryService.getOrders(SecurityUtils.getLoggedInUserName()); ModelAndView model = new ModelAndView("AllOrders"); model.addObject("list", inventorys); return model; }
From source file:gerenciador.incubadora.controller.ArquivoController.java
@RequestMapping(value = "/imagem/upload/{id}", method = RequestMethod.GET) public ModelAndView upload(@PathVariable Long id) throws Exception { Empreendimento empreendimento = ServiceLocator.getEmpreendimentoService().readById(id); ModelAndView mv = new ModelAndView("upload/img"); mv.addObject("empreendimento", empreendimento); return mv;//from ww w . j a v a 2 s. c o m }
From source file:av1.controller.ProcessoController.java
@RequestMapping("novo-processo") public ModelAndView novoProcesso() { FornecedorDAOImpl dao = new FornecedorDAOImpl(); List<Fornecedor> fornecedor = dao.listar(); ModelAndView mv = new ModelAndView("formulario-processo"); mv.addObject("fornecedores", fornecedor); return mv;// w w w .j a v a2 s .c o m }
From source file:br.vschettino.forum.controller.DiscussaoController.java
@RequestMapping(value = "/view/{id}") public ModelAndView view(@PathVariable("id") Long id) { Discussao discussao = discussaoDAO.getDiscussao(id); ModelAndView model = new ModelAndView("viewDiscussao"); model.addObject("discussao", discussao); return model; }
From source file:com.library.bookarticlelibrary.controller.BooksController.java
@RequestMapping(value = "/books/book/editbook/{bookId}", method = RequestMethod.GET) public ModelAndView editBook(@PathVariable("bookId") int bookId) { Book book = bookDao.get(bookId); ModelAndView model = new ModelAndView("editbook"); model.addObject("book", book); return model; }
From source file:com.paulesson.elevator.web.controllers.ElevatorJSPControllerTest.java
/** * Test of showElevators method, of class ElevatorController. *///from w w w . ja v a 2s . co m @Test public void testShowElevators() { List<com.paulesson.elevator.web.model.Elevator> expectedModel = getModelElevatorList(); List<com.paulesson.elevator.web.model.Elevator> resultModel; ElevatorJSPController instance = new ElevatorJSPController(); instance.setElevatorCommandRouter(ecr); ModelAndView expResult = new ModelAndView(ElevatorJSPController.SHOW_ELEVATORS_PAGE); expResult.addObject(ElevatorJSPController.MODEL_ELEVATORS_LIST_NAME, expectedModel); ModelAndView result = instance.showElevators(); assertEquals(expResult.getViewName(), result.getViewName()); Map<String, Object> model = result.getModel(); resultModel = (List<com.paulesson.elevator.web.model.Elevator>) model .get(ElevatorJSPController.MODEL_ELEVATORS_LIST_NAME); for (int i = 0; i < expectedModel.size(); i++) { assertEquals(expectedModel.get(i), resultModel.get(i)); } }
From source file:com.ut.healthelink.controller.solutionsController.java
/** * The '' request will display the solutions overview page. *//*from w w w . j ava 2s. c o m*/ @RequestMapping(value = "", method = RequestMethod.GET) public ModelAndView solutionOverivew() throws Exception { ModelAndView mav = new ModelAndView(); mav.setViewName("/solutionOverivew"); mav.addObject("pageTitle", "Solutions"); return mav; }
From source file:com.z.controllers.HomeController.java
@RequestMapping(method = RequestMethod.GET, params = { "distancia" }) public ModelAndView main(@RequestParam double distancia) { ModelAndView mav = new ModelAndView("main"); mav.addObject("distanciaKM", distancia); return mav;//from w ww . ja v a 2s. co m }
From source file:gg.server.MailController.java
private ModelAndView errorPage(String reason, Exception exception) { log.error("{}: {}", reason, exception.getMessage()); ModelAndView mav = new ModelAndView("error"); mav.addObject("reason", reason); mav.addObject("exception", exception); return mav;// w w w .jav a 2 s .co m }