Example usage for org.springframework.ui Model addAttribute

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

Introduction

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

Prototype

Model addAttribute(String attributeName, @Nullable Object attributeValue);

Source Link

Document

Add the supplied attribute under the supplied name.

Usage

From source file:com.consol.citrus.demo.voting.web.VotingController.java

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String getVoting(@PathVariable("id") String votingId, Model model) {
    model.addAttribute("voting", votingService.get(votingId));
    return "voting-details";
}

From source file:com.qubit.solution.fenixedu.bennu.webservices.ui.WebservicesBaseController.java

@ModelAttribute
protected void addModelProperties(Model model) {
    model.addAttribute("infoMessages", new ArrayList<String>());
    model.addAttribute("warningMessages", new ArrayList<String>());
    model.addAttribute("errorMessages", new ArrayList<String>());

    // Add here more attributes to the Model
    // model.addAttribute(<attr1Key>, <attr1Value>);
    // ..../* ww w.j  a  v  a  2  s  .  co  m*/
}

From source file:com.tianjunwei.modelAttribute.ModelAttributeController.java

@RequestMapping("/modelAttribute")
public String modelAttribute(Model model, @ModelAttribute("test3") String test3) {
    model.addAttribute("test1", "?1");
    model.addAttribute("test3", test3);
    return "modelAttribute";
}

From source file:com.yuga.ygplatform.modules.sys.web.DictController.java

@RequestMapping(value = "form")
public String form(Dict dict, Model model) {
    model.addAttribute("dict", dict);
    return "modules/sys/dictForm";
}

From source file:eu.gyza.eap.eapsocialontology.ontology.SocialOntologyController.java

@RequestMapping(value = "/ontology", method = RequestMethod.GET)
public String ontologies(Model model) {
    ontology.initilize();// w w  w . j a va  2  s. c  om
    model.addAttribute("interests", ontology.getInterestCategories());
    return "ontology/show";
}

From source file:org.unicode4all.lorquotes.controller.QuotesController.java

@RequestMapping("/quotes/{id}")
public String viewQuote(@PathVariable("id") int id, Model model) {
    model.addAttribute("quote", this.quoteService.getQuotesById(id));
    return "quotes/viewquote";
}

From source file:org.wallride.web.controller.admin.category.CategoryIndexController.java

@RequestMapping
public String index(@PathVariable String language, Model model) {
    model.addAttribute("categoryNodes", categoryUtils.getNodes(true));
    return "category/index";
}

From source file:org.wallride.web.controller.admin.category.CategoryIndexController.java

@RequestMapping(params = "part=category-delete-form")
public String partCategoryDeleteForm(@RequestParam long id, Model model) {
    model.addAttribute("targetId", id);
    return "category/index::category-delete-form";
}

From source file:com.jiangnan.es.authorization.privilege.web.controller.PrivilegeController.java

/**
 * ??//from  w  w w .  j  a  v  a  2  s. com
 * @return
 */
@RequestMapping("/")
public String main(Model model) {
    model.addAttribute("operations", operationService.list());
    return "system/auth/privilege/list";
}

From source file:com.lcw.one.modules.sys.web.MenuController.java

@RequiresPermissions("sys:menu:view")
@RequestMapping(value = "form")
public String form(String id, Model model) {
    model.addAttribute("id", id);
    return "modules/sys/menuForm";
}