Example usage for org.springframework.web.servlet ModelAndView ModelAndView

List of usage examples for org.springframework.web.servlet ModelAndView ModelAndView

Introduction

In this page you can find the example usage for org.springframework.web.servlet ModelAndView ModelAndView.

Prototype

public ModelAndView(View view) 

Source Link

Document

Convenient constructor when there is no model data to expose.

Usage

From source file:protocolo.controller.IndexController.java

@RequestMapping(value = "/")
ModelAndView index() {//from w w  w . j  a va  2  s .  co m
    ModelAndView modelAndView = new ModelAndView("index");
    SimpleDateFormat date = new SimpleDateFormat("dd/MM/yyyy");
    modelAndView.addObject("codigo", new Codigo());
    modelAndView.addObject("data", date.format(new Date()));
    return modelAndView;
}

From source file:com.dub.skoolie.web.controller.system.courses.SystemSchoolClassController.java

@RequestMapping(value = "/system/schoolclasses", method = RequestMethod.GET)
public ModelAndView getSchoolClasses() {
    return new ModelAndView("test");
}

From source file:com.wury.app.controller.ErrorController.java

@RequestMapping
public ModelAndView errorPage(HttpServletRequest request) {
    ModelAndView mav = new ModelAndView("all_user/error_page");
    Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");

    switch (statusCode) {
    case 400:/*from   ww w .  ja  v  a2s. co m*/
        mav.addObject("messageProperty", "Bad Request");
        break;
    case 403:
        mav.addObject("messageProperty", "Access Denied");
        break;
    case 404:
        mav.addObject("messageProperty", "Resources Not Found");
        break;
    case 500:
        mav.addObject("messageProperty", "Internal Server Error");
        break;
    default:
        mav.addObject("messageProperty", "Unknown Error");
    }

    String requestUrl = (String) request.getAttribute("javax.servlet.error.request_uri");
    if (requestUrl == null) {
        requestUrl = "Unknown";
    }

    mav.addObject("statusCode", statusCode);
    mav.addObject("requestUrl", requestUrl);
    return mav;
}

From source file:quanlyhocvu.api.web.controller.staff.HomeController.java

@RequestMapping(value = "home")
public @ResponseBody ModelAndView home(HttpServletRequest request) {
    return new ModelAndView("staff/home");
}

From source file:web.Controller.AccessDeniedController.java

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

    return new ModelAndView("accessdenied");
}

From source file:eventmanager.controller.ConfigController.java

@RequestMapping(value = "/User/config")
public ModelAndView config(HttpSession session) {
    ModelAndView modelAndView = new ModelAndView("index");
    User user = (User) session.getAttribute("usuario_logado");
    modelAndView.addObject("usuario", user.getNome());
    modelAndView.addObject("link", true);
    modelAndView.addObject("nomeEvento", new Busca());
    return RenderView.getInstance().renderConfigViewUser(user, modelAndView);
}

From source file:cz.certicon.routing.web.controller.MapController.java

@RequestMapping("/map")
public ModelAndView mapView() {
    ModelAndView modelAndView = new ModelAndView("mapview.jsp");
    modelAndView.getModelMap().addAttribute("name", "YOoooo");
    System.out.println("returning mapview");
    return modelAndView;
}

From source file:org.neposoft.reservation.controllers.PagesController.java

@RequestMapping(value = "/")
public ModelAndView homepage() {
    ModelAndView mv = new ModelAndView("homepage");
    mv.addObject("popularRestaurants", facade.getAllRestaurants());
    return mv;// w w w .ja  va2 s .  c o m
}

From source file:com.neeti.neg.controller.GlobalExceptionController.java

@ExceptionHandler(NEGRuntimeException.class)
public ModelAndView handleCustomException(NEGRuntimeException ex) {

    ModelAndView model = new ModelAndView("errorpage");
    model.addObject("errMsg", ex.getMessage());
    return model;

}

From source file:edu.pitt.sis.infsci2730.finalProject.web.HomeController.java

@RequestMapping(value = "", method = RequestMethod.GET)
public ModelAndView mypage(HttpSession session) {
    return new ModelAndView("index");
}