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:forum.controller.IndexController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public String goToIndex(Model model) {
    model.addAttribute("forums", forumService.findAll());
    model.addAttribute("util", new Utilisateur());

    return "forum/list_forum";
}

From source file:forum.controller.IndexController.java

@RequestMapping(value = "/{idForum}", method = RequestMethod.GET)
public String goToForum(@PathVariable("idForum") long idForum, Model model) {
    model.addAttribute("forum", forumService.findOne(idForum));
    model.addAttribute("util", new Utilisateur());

    return "forum/list_sujet";
}

From source file:forum.controller.IndexController.java

@RequestMapping(value = "/sujet/{idSujet}", method = RequestMethod.GET)
public String goToSujet(@PathVariable("idSujet") long idSujet, Model model) {
    model.addAttribute("sujet", sujetService.findOne(idSujet));
    model.addAttribute("util", new Utilisateur());

    return "forum/list_message";
}

From source file:guru.springframework.controllers.LicenseController.java

@RequestMapping(value = "/licenses", method = RequestMethod.GET)
public String list(Model model) {
    model.addAttribute("licenses", licenseService.listAllLicenses());
    System.out.println("Returning licenses:");
    return "licenses";
}

From source file:org.kew.rmf.matchconf.web.TransformerController.java

void populateEditForm(Model uiModel, Transformer transformer) {
    uiModel.addAttribute("transformer", transformer);
    uiModel.addAttribute("transformers", Transformer.findAllTransformers());
}

From source file:se.omegapoint.facepalm.client.controllers.FriendController.java

@RequestMapping("/friends")
public String friends(final Model model) {
    model.addAttribute("friends", friendAdapter.friendsForCurrentUser());
    return "friends";
}

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

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

From source file:guru.springframework.controllers.LicenseController.java

@RequestMapping("license/new")
public String newLicense(Model model) {
    model.addAttribute("license", new License());
    model.addAttribute("licenses", licenseService.listAllLicenses());

    return "licenseform";
}

From source file:ThuaDatControllers.FormControllers.java

@RequestMapping(value = "/addThuaDat", method = RequestMethod.POST)
public String AddForm(@Valid tblThuaDat objThuaDat, BindingResult result, Model model) {
    model.addAttribute("message", "Xin cho cc bn");
    //tblThuaDat objThuaDat = new tblThuaDat();
    if (result.hasErrors()) {
        return "demoform";
    }//from w  w w.j a v  a 2  s  .co m
    model.addAttribute("tobando", objThuaDat.SHBANDO);
    model.addAttribute("sothua", objThuaDat.SHTHUA);
    return "addThuaDat";
}

From source file:com.weib.spittr.web.SpitterController.java

@RequestMapping(value = "/{username}", method = GET)
public String spitterInfo(@PathVariable String username, Model model) {
    model.addAttribute("spitter", repository.findByUsername(username));
    return "spitter_info";
}