Example usage for org.springframework.ui Model asMap

List of usage examples for org.springframework.ui Model asMap

Introduction

In this page you can find the example usage for org.springframework.ui Model asMap.

Prototype

Map<String, Object> asMap();

Source Link

Document

Return the current set of model attributes as a Map.

Usage

From source file:com.springinpractice.ch11.web.controller.AbstractController.java

/**
 * @param model model//from ww w .  j  a va2  s.com
 * @param nodeId node ID
 * @return node ID
 */
protected String addNavigation(Model model, String nodeId) {
    notNull(model);
    notNull(nodeId);
    model.addAttribute(new Navigation(sitemap, nodeId, model.asMap()));
    return nodeId;
}

From source file:net.triptech.metahive.web.CategoryController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@PreAuthorize("hasRole('ROLE_ADMIN')")
public String delete(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {
    Category.findCategory(id).remove();/* w  ww .  ja  va 2s.  c o  m*/
    uiModel.asMap().clear();

    FlashScope.appendMessage(getMessage("metahive_delete_complete", Category.class), request);

    return "redirect:/lists";
}

From source file:org.kawakicchi.bookshelf.interfaces.series.SeriesController.java

@RequestMapping(value = { "", "/", "/index" }, method = RequestMethod.GET)
public String book(Model model) {
    setting(model);//  www  .  ja v  a2 s  .co  m

    final List<SeriesEntity> seriesList = (List<SeriesEntity>) model.asMap().get("seriesList");

    final List<List<SeriesEntity>> seriesListList = new ArrayList<List<SeriesEntity>>();
    List<SeriesEntity> buf = new ArrayList<SeriesEntity>();
    for (int i = 0; i < seriesList.size(); i++) {
        if (0 == i % 3) {
            seriesListList.add(buf);
            buf = new ArrayList<SeriesEntity>();
        }
        buf.add(seriesList.get(i));
    }
    model.addAttribute("seriesListList", seriesListList);

    return "series/index";
}

From source file:com.baomidou.framework.mail.MailHelper.java

public String getHtmltext(String tplName, Model model) {
    return getHtmltext(tplName, model.asMap());
}

From source file:net.triptech.metahive.web.ConditionOfUseController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@PreAuthorize("hasRole('ROLE_ADMIN')")
public String delete(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {
    ConditionOfUse.findConditionOfUse(id).remove();
    uiModel.asMap().clear();

    FlashScope.appendMessage(getMessage("metahive_delete_complete", ConditionOfUse.class), request);

    return "redirect:/lists";
}

From source file:net.triptech.metahive.web.PersonController.java

@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@PreAuthorize("hasRole('ROLE_ADMIN')")
public String delete(@PathVariable("id") Long id, Model uiModel, HttpServletRequest request) {

    Person.findPerson(id).remove();/* ww w .  j a v a 2s.c o  m*/
    uiModel.asMap().clear();

    FlashScope.appendMessage(getMessage("metahive_delete_complete", Person.class), request);

    return "redirect:/people";
}

From source file:org.fenixedu.bennu.spring.FenixEDUBaseController.java

protected void addInfoMessage(final String message, final Model model) {
    ((List<String>) model.asMap().get(INFO_MESSAGES)).add(message);
}

From source file:org.fenixedu.bennu.spring.FenixEDUBaseController.java

protected void addWarningMessage(final String message, final Model model) {
    ((List<String>) model.asMap().get(WARNING_MESSAGES)).add(message);
}

From source file:org.fenixedu.bennu.spring.FenixEDUBaseController.java

protected void addErrorMessage(final String message, final Model model) {
    ((List<String>) model.asMap().get(ERROR_MESSAGES)).add(message);
}

From source file:org.busko.routemanager.web.api.RouteSubmissionApiController.java

@RequestMapping(method = RequestMethod.POST)
public String create(@Valid RouteSubmission routeSubmission, BindingResult bindingResult, Model uiModel,
        HttpServletRequest httpServletRequest) {
    if (bindingResult.hasErrors()) {
        return "dataAccessFailure";
    }//  www  . ja  v a  2  s. c om
    uiModel.asMap().clear();

    routeSubmission.setSubmittedDateTime(new Date());
    routeSubmission.uploadFileData();
    routeSubmission.persist();
    return "ok";
}