List of usage examples for org.springframework.web.servlet ModelAndView addObject
public ModelAndView addObject(String attributeName, @Nullable Object attributeValue)
From source file:org.fishwife.jrugged.examples.webapp.InterceptPerformanceMonitorExample.java
@RequestMapping("/interceptPerformanceMonitor") public ModelAndView viewMain(HttpServletRequest request, HttpServletResponse response) throws Exception { int delayedFor = interceptResponseTweaker.delay(); ModelAndView view = new ModelAndView("interceptPerf-monitor"); view.addObject("delay", new Integer(delayedFor)); return view;/*from w ww . java2 s . c o m*/ }
From source file:ash.resourcemanager.spring.controllers.AssignmentsController.java
@RequestMapping(value = "assignments", method = RequestMethod.GET) public ModelAndView showAssignments() { List<Assignment> assignments = getAssignmentsDAO().getAll(); ModelAndView modelAndView = new ModelAndView("assignments"); modelAndView.addObject("assignments", assignments); return modelAndView; }
From source file:br.vschettino.forum.controller.DiscussaoController.java
@RequestMapping(value = { "/create" }) public ModelAndView create() { List<Usuario> listUsers = usuarioDAO.list(); ModelAndView model = new ModelAndView("criarDiscussao"); model.addObject("userList", listUsers); return model; }
From source file:net.opentsdb.contrib.tsquare.web.controller.AbstractController.java
/** * Render a JSON view using the given object. * //from ww w .j av a2 s .c o m * @param viewData * @return */ protected ModelAndView jsonSingleObjectView(final Object viewData) { ModelAndView mv = new ModelAndView("jsonSingleObject"); mv.addObject("object", viewData); return mv; }
From source file:net.sourceforge.subsonic.controller.PodcastChannelController.java
@Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); ModelAndView result = super.handleRequestInternal(request, response); result.addObject("model", map); int channelId = ServletRequestUtils.getRequiredIntParameter(request, "id"); map.put("user", securityService.getCurrentUser(request)); map.put("channel", podcastService.getChannel(channelId)); map.put("episodes", podcastService.getEpisodes(channelId)); return result; }
From source file:org.sloth.web.observation.ViewObservationController.java
/** * Handles all request and sets up the view. */// w w w. ja v a2 s. co m @RequestMapping public ModelAndView handle(@PathVariable Long id, HttpSession session, HttpServletResponse response) throws IOException { if (isAuth(session)) { Observation o = this.observationService.getObservation(id); if (o == null) { return notFoundMAV(response); } else if (isAdmin(session) || isOwnObservation(session, o)) { ModelAndView mav = new ModelAndView(VIEW); mav.addObject(OBSERVATIONS_ATTRIBUTE, o); return mav; } } return forbiddenMAV(response); }
From source file:pl.com.softproject.altkom.hibernate.forms.web.controller.FormCreateController.java
@RequestMapping("/addForm") public ModelAndView prepareHTMLForm() { ModelAndView model = new ModelAndView("addForm"); model.addObject("form", new Form()); return model; }
From source file:com.hp.autonomy.frontend.find.core.view.AbstractViewController.java
protected ModelAndView buildErrorModelAndView(final HttpServletRequest request, final String mainMessage, final String subMessage, final boolean contactSupport) { final ModelAndView modelAndView = new ModelAndView(ERROR_PAGE); modelAndView.addObject("mainMessage", mainMessage); modelAndView.addObject("subMessage", subMessage); modelAndView.addObject("baseUrl", getBaseUrl(request)); modelAndView.addObject("contactSupport", contactSupport); return modelAndView; }
From source file:com.amediamanager.controller.ExceptionHandlerController.java
private ModelAndView handle(Exception e, String msg) { LOG.error(msg, e);//from w w w . ja v a 2 s .c o m ModelAndView modelAndView = new ModelAndView(); modelAndView.setViewName("base"); modelAndView.addObject("error", msg); modelAndView.addObject("exMessage", e.getMessage()); modelAndView.addObject("stackTrace", Arrays.toString(e.getStackTrace())); return modelAndView; }
From source file:com.github.fedorchuck.webstore.web.controllers.HomeController.java
@RequestMapping(value = "searchRequest", method = POST) public ModelAndView processSearchRequest(UserActions searchRequest) { //TODO: add validation List<Commodity> response = commodityRepository.findByName(searchRequest.getSearchRequest()); ModelAndView model = new ModelAndView("catalog"); model.addObject("lists", response); return model; }