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:it.geosolutions.geobatch.ui.mvc.FlowManagerController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    Catalog catalog = (Catalog) getApplicationContext().getBean("catalog");

    ModelAndView mav = new ModelAndView("flows");
    mav.addObject("flowManagers", catalog.getFlowManagers(FileBasedFlowManager.class));

    return mav;//from  w w  w  . ja  v a 2  s  . c o m
}

From source file:olsps.com.healthsoftproject.controller.homeController.java

@RequestMapping(value = "/dash", method = RequestMethod.GET)
public ModelAndView getDashBoard() {
    List<Patient> patientList = patientService.list();
    ModelAndView model = new ModelAndView("dashBoard");
    model.addObject("dashBoard", patientList);
    return model;
}

From source file:gov.nih.nci.cabig.caaers.web.admin.ImportMeddraController.java

public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {

    setViewName("admin/meddra_import");
    ModelAndView mav = new ModelAndView("admin/meddra_import");
    mav.addObject("meddraVersions", meddraVersionDao.getAll());
    log.debug("modelAndView" + mav.getViewName());

    return mav;// www .  j ava  2s  .  com
}

From source file:com.lc.storefront.interceptors.beforeview.GoogleMapsBeforeViewHandler.java

@Override
public void beforeView(final HttpServletRequest request, final HttpServletResponse response,
        final ModelAndView modelAndView) throws Exception {
    modelAndView.addObject("googleApiVersion",
            configurationService.getConfiguration().getString(GOOGLE_API_VERSION));
    final String googleApiKey = hostConfigService.getProperty(GOOGLE_API_KEY_ID, request.getServerName());
    if (StringUtils.isNotEmpty(googleApiKey)) {
        modelAndView.addObject("googleApiKey", googleApiKey);
    }//  www.  ja  va 2  s  .co  m
}

From source file:com.opencart.controller.MainController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView showIndex() {
    ModelAndView mv = new ModelAndView("front/index");
    mv.addObject("categories", categoryService.list());
    mv.addObject("subcategories", subcategoryService.list());
    return mv;//w ww .  ja v a 2 s.  c om
}

From source file:com.sishuok.chapter3.web.controller.WebAsyncTaskController.java

@ExceptionHandler
public ModelAndView exceptionHandler(Exception e) {
    ModelAndView mv = new ModelAndView("exception");
    mv.addObject("exception", e);
    return mv;/*from   w  ww.  j a  va2 s.  c o  m*/
}

From source file:controller.HolaController.java

protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
        BindException errors) throws Exception {
    Nombre nombre = (Nombre) command;/* w w w.j  av a 2 s  . co  m*/
    ModelAndView mv = new ModelAndView(getSuccessView());
    mv.addObject("holaMensaje", holaService.diHola(nombre.getValor()));
    //Do something...
    return mv;
}

From source file:edu.bbu.security.web.controllers.MainController.java

@RequestMapping(value = "/admin**", method = RequestMethod.GET)
public ModelAndView adminPage() {
    System.out.println("lofasz admin");
    ModelAndView model = new ModelAndView();
    model.addObject("title", "Spring Security Custom Login Form");
    model.addObject("message", "This is protected page!");
    model.setViewName("admin");

    return model;

}

From source file:net.sourceforge.subsonic.controller.AllmusicController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    ModelAndView result = super.handleRequestInternal(request, response);
    result.addObject("album", request.getParameter("album"));
    return result;
}

From source file:tld.mydomain.example.site.controller.IndexController.java

/**
 * Login Mask/*w  ww  .j  a  v a 2  s.  co  m*/
 * @param loginReturn
 * @return
 */
@RequestMapping("/login")
public ModelAndView login(@RequestParam(value = "lreturn", required = false) String loginReturn) {

    ModelAndView model = new ModelAndView("index/Login");

    model.addObject("lreturn", loginReturn);

    return model;
}