List of usage examples for org.springframework.web.servlet ModelAndView addObject
public ModelAndView addObject(String attributeName, @Nullable Object attributeValue)
From source file:com.library.bookarticlelibrary.controller.ArticlesController.java
@RequestMapping(value = "/articles/article/{articleId}", method = RequestMethod.GET) public ModelAndView displayArticle(@PathVariable("articleId") int articleId) { Article article = articleDao.get(articleId); ModelAndView model = new ModelAndView("article"); model.addObject("title", "articles"); model.addObject("article", article); System.out.println("hallo"); return model; }
From source file:com.logsniffer.web.controller.exception.ExceptionControllerAdvice.java
@ExceptionHandler(ActionViolationException.class) public ModelAndView handleActionViolation(final ActionViolationException ex) { logger.info("Catched action violation exception", ex); final ModelAndView mv = new ModelAndView("errors/action-violation"); mv.addObject("ex", ex); return mv;//w w w . jav a 2 s . c om }
From source file:net.sourceforge.subsonic.controller.TopController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); User user = securityService.getCurrentUser(request); UserSettings userSettings = settingsService.getUserSettings(user.getUsername()); map.put("user", user); map.put("showSideBar", userSettings.isShowSideBar()); map.put("showAvatar", userSettings.getAvatarScheme() != AvatarScheme.NONE); ModelAndView result = super.handleRequestInternal(request, response); result.addObject("model", map); return result; }
From source file:org.fishwife.jrugged.examples.webapp.AspectPerformanceMonitorExample.java
@RequestMapping("/aspectPerformanceMonitor") public ModelAndView viewMain(HttpServletRequest request, HttpServletResponse response) throws Exception { int delayedFor = aspectResponseTweaker.delay(); ModelAndView view = new ModelAndView("aspectPerf-monitor"); view.addObject("delay", new Integer(delayedFor)); return view;/*from w w w . ja va2 s. c om*/ }
From source file:org.home.petclinic2.controller.VisitController.java
/** * Shows list of visits for pet/*from w ww . j ava2s . c o m*/ * <p> * Doesn't look like it was ever implemented though * * @param petId * @return */ @RequestMapping(value = "/owner/*/pet/{petId}/visit", method = RequestMethod.GET) public ModelAndView showVisit(@PathVariable int petId) { ModelAndView mav = new ModelAndView("visitList"); mav.addObject("visits", clinicService.findPetById(petId).getVisits()); return mav; }
From source file:org.sample.TimeController.java
@RequestMapping(method = RequestMethod.GET, value = { "/tick" }) public ModelAndView get() throws Exception { Connection connection = jmsFactory.createConnection(); Session jmsSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); SecureRandom srandom = new SecureRandom(); String rand = new BigInteger(176, srandom).toString(32); String q = Long.toString(System.currentTimeMillis()) + "-" + rand; Destination destination = jmsSession.createQueue(q); Timer timer = new Timer(); long delay = 1 * 1000; timer.schedule(new TickTask(jmsSession, destination), 0, delay); ModelAndView mav = new ModelAndView("client"); mav.addObject("queue", destination.toString()); return mav;//from w w w .j a va 2 s .c o m }
From source file:org.sarons.spring4me.web.servlet.DispatcherServlet.java
private void exportContextPath(HttpServletRequest request, ModelAndView mv) { mv.addObject(Keys.REQUEST_KEY_BASE, request.getContextPath()); request.setAttribute(Keys.REQUEST_KEY_BASE, request.getContextPath()); }
From source file:com.company.controller.admin.StudentController.java
@RequestMapping(value = "/add", method = RequestMethod.GET) public ModelAndView add() { ModelAndView mv = new ModelAndView("admin/student/add"); mv.addObject("Student", new Student()); return mv;/*from w w w . j a va2s . co m*/ }
From source file:com.library.bookarticlelibrary.controller.JournalsController.java
@RequestMapping(value = "/journals/journal/{journalId}", method = RequestMethod.GET) public ModelAndView displayJournal(@PathVariable("journalId") int journalId) { ModelAndView model = new ModelAndView("journal"); Journal journal = journalDao.get(journalId); model.addObject("title", "journals"); model.addObject("journal", journal); return model; }
From source file:com.logsniffer.web.controller.system.SystemBaseController.java
@RequestMapping(value = "/system", method = RequestMethod.GET) public ModelAndView renderSystem(@RequestParam(value = "path", required = false) final String path) { List<NavNode> breadcrumbNodes = new ArrayList<NavNode>(); breadcrumbNodes.add(systemNode);// w ww .j a va 2 s . c om ModelAndView mv = new ModelAndView("system/main"); mv.addObject("rootNode", systemNode); NavNode activeNode = getActiveNode(systemNode, path); mv.addObject("breadcrumbNodes", getBreadcrumb(activeNode)); mv.addObject("activeNode", activeNode); return mv; }