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.gantzgulch.sharing.controller.UserEditController.java

@RequestMapping(method = RequestMethod.POST)
public ModelAndView processForm(@Valid UserForm userForm, BindingResult result, Map<String, Object> model) {

    if (result.hasErrors()) {
        ModelAndView modelAndView = new ModelAndView(".userEdit");
        modelAndView.addObject("roleList", UserRole.getRoleList());
        return modelAndView;
    }/* ww  w  .  ja  va  2  s  .  c  o m*/

    if (StringUtils.isBlank(userForm.getId())) {
        userManager.create(userForm);
    } else {
        userManager.update(userForm);
    }

    return new ModelAndView("redirect:/secure/admin/user.htm", "id", userForm.getId());
}

From source file:com.ut.healthelink.controller.productSuiteController.java

/**
 * The '/health-e-net' request will display the health-e-net information page.
 */// ww w.j ava  2  s  .c  om
@RequestMapping(value = "/health-e-net", method = RequestMethod.GET)
public ModelAndView healthenet() throws Exception {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("/healthenet");
    mav.addObject("pageTitle", "Health-e-Net");
    return mav;
}

From source file:com.ut.healthelink.controller.productSuiteController.java

/**
 * The '/health-e-web' request will display the health-e-web information page.
 *///from ww  w .  j a  v a 2s . com
@RequestMapping(value = "/health-e-web", method = RequestMethod.GET)
public ModelAndView healtheweb() throws Exception {

    ModelAndView mav = new ModelAndView();
    mav.setViewName("/healtheweb");
    mav.addObject("pageTitle", "Health-e-Web");
    return mav;
}

From source file:it.jugpadova.controllers.JuggerAdminController.java

/**
 * Jugger details// ww w  .  j a va2  s.  co  m
 * 
 * @param req
 * @param res
 * @return
 */
@RequestMapping
public ModelAndView viewJugger(HttpServletRequest req, HttpServletResponse res) {
    String username = req.getParameter("username");
    ModelAndView mv = new ModelAndView("jugger/admin/viewJugger");
    mv.addObject("jugger", juggerBo.searchByUsername(username));
    return mv;
}