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(Object attributeValue) 

Source Link

Document

Add an attribute to the model using parameter name generation.

Usage

From source file:org.antbear.jee.spring.FirstController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView homepageHandler() {
    ModelAndView mav = new ModelAndView("first"); // Logical view name
    mav.addObject(new First());
    return mav;//  w  w w .  j  ava2  s .  co  m
}

From source file:com.vizaco.onlinecontrol.controller.StudentController.java

@RequestMapping("/students/{studentId}")
public ModelAndView showOwner(@PathVariable("studentId") String studentId) {
    ModelAndView mav = new ModelAndView("students/studentDetails");
    mav.addObject(this.onlineControlService.findStudentById(studentId));
    return mav;// w ww  .ja  v a2s  . com
}

From source file:org.smigo.config.RestExceptionResolver.java

private ModelAndView getModelAndView(HttpServletResponse response, HttpStatus httpStatus, Object[] model) {
    if (response.getStatus() == 200) {
        response.setStatus(httpStatus.value());
    }//from   w w w  .j ava  2  s.  c o  m
    ModelAndView jsonView = new ModelAndView(view);
    jsonView.addObject(model);
    return jsonView;
}

From source file:com.github.fedorchuck.webstore.web.controllers.HomeController.java

@RequestMapping(method = GET)
public ModelAndView home(HttpServletRequest request) {
    request.getSession().setAttribute("session", session);

    ModelAndView model = new ModelAndView("index");
    model.addObject(new Commodity());
    model.addObject("userActions", new UserActions());

    List<Category> categories = commodityRepository.findByCategory();
    model.addObject("categories", categories);

    return model;
}

From source file:com.github.fedorchuck.webstore.web.controllers.GoodsController.java

@RequestMapping(value = "add", method = GET)
public ModelAndView showGoodsForm(ModelAndView model) {
    model.addObject(new Commodity());
    model.addObject("userActions", new UserActions());
    model.addObject("radioItems", RADIO_ITEMS);
    model.setViewName("goodsForm");
    return model;
}