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

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

Introduction

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

Prototype

public ModelMap getModelMap() 

Source Link

Document

Return the underlying ModelMap instance (never null ).

Usage

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:company.gonapps.loghut.web.interceptor.SettingsAddingHandlerInterceptor.java

@Override
public void postHandle(final HttpServletRequest request, final HttpServletResponse response,
        final Object handler, final ModelAndView modelAndView) {
    if (modelAndView != null)
        modelAndView.getModelMap().addAttribute("settings", settingDao);
}

From source file:com.excilys.ebi.bank.web.interceptor.calendar.CalendarModelAttributeHandlerInterceptor.java

@Override
protected void postHandleInternal(HttpServletRequest request, HttpServletResponse response,
        HandlerMethod handlerMethod, ModelAndView modelAndView, Map<String, ?> pathVariables) throws Exception {
    exportCalendar(modelAndView.getModelMap(), pathVariables);
}

From source file:com.excilys.ebi.bank.web.interceptor.account.AccountModelAttributeHandlerInterceptor.java

@Override
protected void postHandleInternal(HttpServletRequest request, HttpServletResponse response,
        HandlerMethod handlerMethod, ModelAndView modelAndView, Map<String, ?> pathVariables) throws Exception {
    exportAccount(modelAndView.getModelMap(), pathVariables);
}

From source file:abid.password.springmvc.controller.ViewUsersController.java

@RequestMapping(method = RequestMethod.GET, value = { "/users" })
public ModelAndView handleGetUsers() {
    ModelAndView model = new ModelAndView("viewUsers");
    List<User> users = userService.getUsers();
    model.getModelMap().put("users", users);
    return model;
}

From source file:org.impalaframework.extension.mvc.flash.FlashStateEnabledAnnotationHandlerAdapter.java

protected void afterHandle(HttpServletRequest request, ModelAndView modelAndView) {

    final ModelMap modelMap = modelAndView.getModelMap();

    flashHelper.afterHandleRequest(request, modelMap);

    boolean isRedirect = RequestModelHelper.isRedirect(modelAndView);

    if (!isRedirect)
        RequestModelHelper.setParameters(request, modelMap);
}

From source file:com.carlos.projects.billing.ui.controllers.SelectComponentsController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    ModelAndView mav = super.handleRequestInternal(request, response);
    mav.getModelMap().addAttribute("components",
            getComponents((Map<String, String[]>) request.getParameterMap()));
    mav.getModelMap().addAttribute("familyName", request.getParameter("familyName"));

    String documentId = request.getParameter("documentId");
    if (!isEmpty(documentId) && isNumeric(documentId)) {
        mav.getModelMap().addAttribute("documentId", Long.parseLong(documentId));
    }/*from  w w  w  .  ja v  a 2  s  . com*/
    return mav;
}

From source file:nl.surfnet.coin.teams.interceptor.FeatureInterceptor.java

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) throws Exception {
    if (modelAndView != null) {
        ModelMap map = modelAndView.getModelMap();
        map.addAttribute("displayExternalTeams", displayExternalTeams);
        map.addAttribute("displayExternalTeamMembers", displayExternalTeamMembers);
        map.addAttribute("displayAddExternalGroupToTeam", displayAddExternalGroupToTeam);
    }/*  w w  w .  j av  a2s .  c o  m*/
    super.postHandle(request, response, handler, modelAndView);
}

From source file:com.carlos.projects.billing.ui.controllers.AddComponentsController.java

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    ModelAndView modelAndView = super.handleRequestInternal(request, response);
    modelAndView.getModelMap().addAttribute("familyName", request.getParameter("familyName"));
    modelAndView.getModelMap().addAttribute("document",
            getDocumentWithComponentsAdded(request.getParameterMap()));
    return modelAndView;
}

From source file:com.zte.gu.webtools.web.ddm.DdmController.java

@RequestMapping(method = RequestMethod.POST)
public ModelAndView scan(@RequestParam(required = true) MultipartFile boardFile,
        @RequestParam(required = true) MultipartFile ruFile, @RequestParam(required = true) String sdrVer,
        HttpSession session) {//from   w  ww .j  a  v  a2s. c  o  m
    List<DdmVersion> versions = ddmService.getAllVersion();
    ModelAndView modelAndView = new ModelAndView("ddm/ddmScan");
    modelAndView.getModelMap().addAttribute("versions", versions);
    if (boardFile.isEmpty()) {
        modelAndView.getModelMap().addAttribute("error", "?");
    }
    if (!ACCEPT_TYPES.contains(boardFile.getContentType())) {
        modelAndView.getModelMap().addAttribute("error", "???");
    }
    if (ruFile.isEmpty()) {
        modelAndView.getModelMap().addAttribute("error", "RU?");
    }
    if (!ACCEPT_TYPES.contains(ruFile.getContentType())) {
        modelAndView.getModelMap().addAttribute("error", "RU???");
    }

    InputStream boardInput = null;
    InputStream ruInput = null;
    try {
        boardInput = boardFile.getInputStream();
        ruInput = ruFile.getInputStream();
        File tempZipFile = ddmService.exportXml(boardInput, ruInput, sdrVer); //?
        if (tempZipFile != null) {
            session.setAttribute("filePath", tempZipFile.getPath());
            session.setAttribute("fileName", "ddm.zip");
            modelAndView.setViewName("redirect:/download");
        }
    } catch (Exception e) {
        LoggerFactory.getLogger(DdmController.class).warn("download error,", e);
        modelAndView.getModelMap().addAttribute("error", "?" + e.getMessage());
    } finally {
        IOUtils.closeQuietly(boardInput);
        IOUtils.closeQuietly(ruInput);
    }
    return modelAndView;
}