Example usage for org.springframework.ui ModelMap addAttribute

List of usage examples for org.springframework.ui ModelMap addAttribute

Introduction

In this page you can find the example usage for org.springframework.ui ModelMap addAttribute.

Prototype

public ModelMap addAttribute(String attributeName, @Nullable Object attributeValue) 

Source Link

Document

Add the supplied attribute under the supplied name.

Usage

From source file:nl.surfnet.coin.teams.util.ViewUtil.java

/**
 * Defines which view must be presented and adds it to the ModelMap
 *
 * @param request  current {@link HttpServletRequest}
 * @param modelMap {@link ModelMap} on which the view name is added
 *///w ww .  j ava2 s .c o  m
public static void addViewToModelMap(HttpServletRequest request, ModelMap modelMap) {
    modelMap.addAttribute(VIEW, getView(request));
}

From source file:controller.Utils.java

static void drawHomePage(String username, int nbreNotifs, String ColonGauche, String ColonDroite,
        ModelMap model) {

    model.addAttribute("message", "Welcome " + username);
    model.addAttribute("numberOfNot", nbreNotifs);
    model.addAttribute("colonneGauche", ColonGauche);
    model.addAttribute("colonneDroite", ColonDroite);

}

From source file:controller.Utils.java

static void drawHomePageCompany(String username, int nbreNotifs, String ColonGauche, String ColonDroite,
        ModelMap model, List<InternshipCompanyModel> offers) {
    model.addAttribute("message", "Welcome " + username);
    model.addAttribute("numberOfNot", nbreNotifs);
    model.addAttribute("colonneGauche", ColonGauche);
    model.addAttribute("colonneDroite", ColonDroite);
    model.addAttribute("offers", offers);
}

From source file:org.openmrs.module.rwandaprimarycare.PrimaryCareWebLogic.java

public static Patient findParentsNamesAttributes(List<Person> parents, Patient patient, ModelMap map) {
    if (parents.size() == 0 && PrimaryCareUtil.hasParentsNamesAttributes(patient)) {
        map.addAttribute("mumStr",
                patient.getAttribute(Context.getPersonService()
                        .getPersonAttributeTypeByName(PrimaryCareConstants.MOTHER_NAME_ATTRIBUTE_TYPE))
                        .getValue());/*from   w  w w.  j  a v a  2s.  c  o m*/
        map.addAttribute("dadStr",
                patient.getAttribute(Context.getPersonService()
                        .getPersonAttributeTypeByName(PrimaryCareConstants.FATHER_NAME_ATTRIBUTE_TYPE))
                        .getValue());
    } else {
        map.addAttribute("mumStr", "");
        map.addAttribute("dadStr", "");
    }
    return patient;
}

From source file:com.alibaba.jstorm.ui.utils.UIUtils.java

public static void addErrorAttribute(ModelMap model, Exception e) {
    String errMsg = JStormUtils.getErrorInfo(e);
    String err = "!!!!!!!!!!!!!!!! Error:" + e.getMessage() + " !!!!!!!!!\r\n\r\n" + errMsg;
    model.addAttribute("error", err);
}

From source file:org.openmrs.module.accounting.web.controller.AccountingMainController.java

@RequestMapping(value = "/module/accounting/main.htm", method = RequestMethod.GET)
public void main(ModelMap model) {
    model.addAttribute("user", Context.getAuthenticatedUser());
}

From source file:thymeleafexamples.tilestest.web.controller.TilesTestController.java

@RequestMapping("/jsp{num}")
public String jsp(@PathVariable("num") final Integer num, final ModelMap model) {
    model.addAttribute("var0", "[VAR ZERO]");
    return "jsp" + num + ".tiles";
}

From source file:thymeleafexamples.tilestest.web.controller.TilesTestController.java

@RequestMapping("/thymeleaf{num}")
public String thymeleaf(@PathVariable("num") final Integer num, final ModelMap model) {
    model.addAttribute("var0", "[VAR ZERO]");
    return "thymeleaf" + num + ".tiles";
}

From source file:thymeleafexamples.tilestest.web.controller.TilesTestController.java

@RequestMapping("/thymeleafWildcard/{param}")
public String thymeleafWild(@PathVariable("param") final String param, final ModelMap model) {
    model.addAttribute("var0", "[VAR ZERO]");
    return "thymeleafWildcard.tiles" + param;
}

From source file:thymeleafexamples.tilestest.web.controller.TilesTestController.java

@RequestMapping("/jspWildcard/{param}")
public String jspWild(@PathVariable("param") final String param, final ModelMap model) {
    model.addAttribute("var0", "[VAR ZERO]");
    return "jspWildcard.tiles" + param;
}