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:com.mycompany.springmvcaccount.controller.UserFormController.java

@RequestMapping(value = "/resultForm", method = RequestMethod.POST)
public ModelAndView resultForm(User user) {
    ModelAndView mv = new ModelAndView();
    mv.addObject("user", user);
    mv.setViewName("userResult");
    return mv;/*  w  w  w  .  jav  a  2 s .c  om*/
}

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

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

    mav.addObject("user", "hello");
    return mav;//  w w w  .  j a v a2  s .  c  o m
}

From source file:com.leapfrog.inventorymanagementsystem.controller.DefaultController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView index() {
    ModelAndView mv = new ModelAndView("index");
    mv.addObject("title", "Welcome to Inventory Management System");
    return mv;//  w w  w.jav a 2  s  .  com
}

From source file:com.leapfrog.inventorymanagementsystem.controller.LoginController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView index() {
    ModelAndView mv = new ModelAndView("login");
    mv.addObject("title", "Please Login");
    return mv;/*from  ww w.j a  v a2s  .c  om*/
}

From source file:com.hortonworks.example.ambari.AmbariController.java

@RequestMapping(value = "/ambari", method = RequestMethod.GET)
public ModelAndView ambari() {
    ModelAndView model = new ModelAndView();
    model.addObject("title", "Ambari Mock UI");
    model.addObject("message", "This is protected page!");
    model.setViewName("ambari");
    return model;
}

From source file:com.orchestra.portale.controller.WelcomeController.java

@RequestMapping("/welcome")
public ModelAndView welcomePage() {
    ModelAndView model = new ModelAndView("welcome");
    model.addObject("obj", new Oggetto());
    return model;
}

From source file:com.web.mavenproject6.other.GlobalExceptionHandler.java

@ExceptionHandler(Exception.class)
public ModelAndView handleIOException(HttpServletRequest req, Map<String, Object> model, Exception ex) {
    ModelAndView mav = new ModelAndView();
    mav.addObject("exception", ex);
    mav.addObject("url", req.getRequestURL());
    mav.setViewName("thy/error/Exception");
    return mav;/*  ww w  .j ava 2  s  . c om*/
}

From source file:org.simon.pascal.controller.HelloController.java

@RequestMapping("/index.htm")
public ModelAndView index() {
    ModelAndView mav = new ModelAndView("index");
    mav.addObject("projectVersion", projectVersion);
    return mav;// ww  w . j a  v a2 s .co m
}

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

@RequestMapping(value = "/foo")
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;//  www . ja va  2  s  .  co m
}

From source file:de.dentrassi.osgiee.web4.WelcomeController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView index() {
    final ModelAndView mv = new ModelAndView("index");

    mv.addObject("timestamp", System.currentTimeMillis());

    return mv;//from  ww  w. jav  a 2s .com
}