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:WebControllers.ControladorFuncionesComunes.java

public void cargaContenidoComun(HttpServletRequest request, ModelAndView view) {
    view.addObject("contextpath", Constantes.CONTEXTPATH);
}

From source file:com.tianjunwei.handlerExceptionResolver.MyHandlerExceptionResolver.java

@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
        Exception ex) {/*from  w ww.j ava 2s .c  o m*/

    ModelAndView mv = new ModelAndView("exception");
    mv.addObject("errorMsg", ex.getMessage());
    return mv;
}

From source file:my.ctr.MainController.java

@RequestMapping("test.do")
ModelAndView test() {//from w w w .j  a  v a2 s.  c om
    ModelAndView mv = new ModelAndView("testview");
    mv.addObject("towns", gameService);
    return mv;
}

From source file:uk.org.funcube.fcdw.controller.RealtimeController.java

@RequestMapping(value = "", method = RequestMethod.GET)
public ModelAndView getFuncube() {
    ModelAndView model = new ModelAndView("realtime");
    model.addObject("satelliteId", "2");
    return model;
}

From source file:uk.org.funcube.fcdw.controller.RealtimeController.java

@RequestMapping(value = "/{satelliteId}", method = RequestMethod.GET)
public ModelAndView getSatellite(@PathVariable("satelliteId") Long satelliteId) {
    ModelAndView model = new ModelAndView("realtime");
    model.addObject("satelliteId", satelliteId.toString());
    return model;
}

From source file:eu.trentorise.smartcampus.permissionprovider.controller.GlobalDefaultExceptionHandler.java

public ModelAndView resolveException(HttpServletRequest aReq, HttpServletResponse aRes, Object aHandler,
        Exception anExc) {//w w w  . j a v  a2  s  .  c o m
    // Otherwise setup and send the user to a default error-view.
    ModelAndView mav = new ModelAndView();
    mav.addObject("exception", anExc);
    mav.addObject("url", aReq.getRequestURL());
    mav.setViewName(DEFAULT_ERROR_VIEW);
    return mav;
}

From source file:org.jasig.portlet.conference.program.mvc.servlet.ConferenceProgramFeedController.java

@RequestMapping("program/{hash}.json")
public ModelAndView getProgram(@PathVariable String hash) {
    ModelAndView mav = new ModelAndView("json");
    mav.addObject("sessions", dao.getProgram().getSessions());
    return mav;// w  w w.j  ava 2  s. c o  m
}

From source file:com.beto.test.securityinterceptor.controller.templateController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    ModelAndView model = new ModelAndView("menu");
    model.addObject("msg", "hello world!");
    for (SecPageDef def : ms.pageList()) {
        logger.debug("PAGE : " + def.getViewId());
    }//w  w w  . ja va 2  s  .c om
    model.addObject("menu", ms.pageList());
    return model;
}

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

@ExceptionHandler
public ModelAndView exceptionHandler(RuntimeException e) {
    ModelAndView mv = new ModelAndView("exception");
    mv.addObject("exception", e);
    return mv;//from  w  ww.j a va 2  s .  com
}

From source file:com.test1.controller.LoginController.java

@RequestMapping(value = "/loginSubmit", method = RequestMethod.POST)
public ModelAndView login(@RequestParam("username") String username,
        @RequestParam("password") String password) {
    ModelAndView mav = new ModelAndView("redirect:home");
    mav.addObject("username", username);
    mav.addObject("password", password);
    return mav;//from   w  ww .  ja v  a  2 s. c  om
}