Example usage for org.springframework.web.servlet ModelAndView addObject

List of usage examples for org.springframework.web.servlet ModelAndView addObject

Introduction

In this page you can find the example usage for org.springframework.web.servlet ModelAndView addObject.

Prototype

public ModelAndView addObject(String attributeName, @Nullable Object attributeValue) 

Source Link

Document

Add an attribute to the model.

Usage

From source file:org.neposoft.reservation.controllers.PagesController.java

@RequestMapping(value = "/")
public ModelAndView homepage() {
    ModelAndView mv = new ModelAndView("homepage");
    mv.addObject("popularRestaurants", facade.getAllRestaurants());
    return mv;// www  .j a v  a2s.co  m
}

From source file:com.freetest.test.controller.UserAction.java

@RequestMapping(value = "/login", method = { RequestMethod.GET })
public ModelAndView login() {
    ModelAndView mav = new ModelAndView("user/user");

    mav.addObject("user", "hello");
    return mav;//from www.ja va  2 s.c om
}

From source file:com.kdgregory.pathfinder.test.scan.controller.ControllerB.java

@RequestMapping(value = "/bar", method = RequestMethod.GET)
protected ModelAndView getBar(HttpServletRequest request, HttpServletResponse response) throws Exception {
    ModelAndView mav = new ModelAndView("simple");
    mav.addObject("reqUrl", request.getRequestURI());
    mav.addObject("controller", getClass().getName());
    return mav;// ww w.  j  a v  a 2 s.c  o m
}

From source file:com.leapfrog.lfaeventmanager.admin.controller.LoginController.java

@RequestMapping(value = "login", method = RequestMethod.GET)
public ModelAndView displayLogin() {
    ModelAndView mv = new ModelAndView("login/login");
    mv.addObject("userList", userService.getAll());
    return mv;//ww w . java 2 s  .  c o  m
}

From source file:controllers.NotificationController.java

@RequestMapping(value = "notification", method = RequestMethod.GET)
public ModelAndView notification(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView model = new ModelAndView("page");
    model.addObject("content", "notification");
    return model;
}

From source file:uta.ak.usttmp.console.controller.HelloWorldController.java

@RequestMapping("/hello")
public ModelAndView helloWorld() {

    String message = "Hello World, Spring 3.0!";

    ModelAndView mav = new ModelAndView("hello");
    mav.addObject("message", message);
    mav.addObject("", message);
    return mav;//from ww w.j a va 2s . c  o  m
}

From source file:uta.ak.usttmp.dmcore.controller.HelloWorldController.java

@RequestMapping("/hello")
public ModelAndView helloWorld() {

    String message = "Hello World, This is dm core application. " + "Please control me by rest interface. :)";

    ModelAndView mav = new ModelAndView("hello");
    mav.addObject("message", message);
    mav.addObject("", message);
    return mav;//w w w. j  av  a2  s .  c o  m
}

From source file:com.kdgregory.pathfinder.test.spring3.pkg1.ControllerA.java

@RequestMapping(value = "/foo.html")
protected ModelAndView getFoo(HttpServletRequest request, HttpServletResponse response) throws Exception {
    ModelAndView mav = new ModelAndView("simple");
    mav.addObject("reqUrl", request.getRequestURI());
    mav.addObject("controller", getClass().getName());
    return mav;/*from  w  w w .ja va 2  s .c  o m*/
}

From source file:interceptors.AccessControlInterceptor.java

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) throws Exception {

    modelAndView.addObject("authError", "You are not authorized to do that");
}

From source file:org.fits.proweb.controller.exception.ExceptionController.java

@ExceptionHandler(CannotGetJdbcConnectionException.class)
public ModelAndView CannotGetConnectionException(Exception ex) {
    ModelAndView model = new ModelAndView("errors/db_error");
    model.addObject("ex", ex);
    return model;
}