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

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

Introduction

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

Prototype

public ModelAndView addAllObjects(@Nullable Map<String, ?> modelMap) 

Source Link

Document

Add all attributes contained in the provided Map to the model.

Usage

From source file:net.mindengine.oculus.frontend.web.controllers.issue.IssueSearchController.java

@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
        BindException errors) throws Exception {
    ModelAndView mav = new ModelAndView(getSuccessView());
    mav.addAllObjects(referenceData(request, command, errors));
    return mav;/*w w w . ja  v  a  2  s. c  o  m*/
}

From source file:code.tianmao.h5.controller.BackendExceptionController.java

protected ModelAndView prepareExceptionInfo(HttpServletRequest request, HttpStatus httpStatus, String errorCode,
        String errorMessage) {/*from w w  w. j  ava  2s.c  o  m*/
    Map<String, Object> models = new LinkedHashMap<>();
    models.put("errorCode", errorCode);
    models.put("errorMessage", errorMessage);
    ModelAndView modelAndView = new ModelAndView();
    if (noNeedWrapper(request)) {
        modelAndView.setView(DEFAULT_JSON_VIEW);
        modelAndView.addAllObjects(models);
        return modelAndView;
    } else {
        modelAndView.setViewName("error");
        modelAndView.addAllObjects(models);
        return modelAndView;
    }
}

From source file:kievreclama.task.controllers.EmployeeController.java

@RequestMapping(value = "/add")
public ModelAndView getPageFormAdd() {
    ModelAndView model = new ModelAndView();
    model.setViewName("form-employee-add");
    model.addObject("modelEmployee", new EmployeeModel());
    model.addAllObjects(employeeService.allCompnents());
    return model;
}

From source file:kievreclama.task.controllers.EmployeeController.java

@GetMapping(value = "/edit/{id}")
public ModelAndView getPageFormaEmployee(@PathVariable int id) {
    ModelAndView model = new ModelAndView();
    model.setViewName("form-employee-edit");
    model.addObject("modelEmployee", employeeService.getId(id));
    model.addAllObjects(employeeService.allCompnents());
    return model;
}

From source file:net.mindengine.oculus.frontend.web.controllers.project.ProjectBrowseController.java

@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
        BindException errors) throws Exception {
    ModelAndView mav = new ModelAndView(getSuccessView());
    setFilter((ProjectBrowseFilter) command);
    mav.addObject("projectBrowseFilter", command);
    mav.addAllObjects(referenceData(request));
    return mav;/*from   www. j a va 2  s . c  om*/
}

From source file:net.mindengine.oculus.frontend.web.controllers.report.ReportBrowseAjaxController.java

@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
        BindException errors) throws Exception {
    ModelAndView mav = new ModelAndView(getSuccessView());
    mav.addObject("reportSearchFilter", command);
    mav.addAllObjects(referenceData(request, command, errors));
    return mav;//from ww w  .j a v  a2s.co m
}

From source file:net.mindengine.oculus.frontend.web.controllers.SecureSimpleViewController.java

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

    verifyPermissions(request);/* w ww .  j  ava2  s  .  com*/
    Map<String, Object> model = null;

    try {
        model = handleController(request);
        if (model != null) {
            if (!model.containsKey("title")) {
                model.put("title", title);
            }
        }
    } catch (RedirectException redirectException) {
        return new ModelAndView(new RedirectView(redirectException.getRedirectUrl()));
    }

    if (view == null)
        throw new Exception("The view is not defined");

    ModelAndView mav = new ModelAndView(view);
    if (model != null)
        mav.addAllObjects(model);

    return mav;
}

From source file:org.craftercms.social.util.web.RestMappingExceptionResolver.java

@Override
protected ModelAndView getModelAndView(String viewName, Exception ex) {
    ModelAndView mv = new ModelAndView(viewName);
    HashMap<String, Object> map = new HashMap<>();
    map.put("message", ex.getMessage());
    map.put("localizedMessage", ex.getLocalizedMessage());
    mv.addAllObjects(map);
    return mv;//from w  w  w  .  j  ava2  s .c o m
}

From source file:org.inbio.modeling.web.controller.UpdateUserInfoController.java

@Override
protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException errors)
        throws Exception {

    ModelAndView model = new ModelAndView();
    if (errors != null && errors.hasErrors())
        model.addAllObjects(errors.getModel());

    model.setViewName("admin/userDetails");
    return model;
}

From source file:lt.walrus.ajax.WalrusRedirectAction.java

/**
 * Construct the action./*from   ww w .  j ava 2 s . co  m*/
 * 
 * @param url
 *            The redirect url.
 * @param model
 *            The view model as a
 *            {@link org.springframework.web.servlet.ModelAndView} object,
 *            containing parameters to pass to the new view.
 */
public WalrusRedirectAction(String url, ModelAndView model) {
    this.url = url;
    if (model != null && model.getModel() != null) {
        this.model = new HashMap<String, String>();
        model.addAllObjects(model.getModel());
    } else {
        this.model = new HashMap<String, String>(1);
    }
}