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.neeti.neg.controller.MainController.java

@RequestMapping(value = "/register", method = RequestMethod.GET)
public String viewRegisterUser(Model m) {
    m.addAttribute("registerUser", new RegisterUser());
    return "register";
}

From source file:demo.controllers.GreetingController.java

@RequestMapping
public String index(Model model, @RequestParam(defaultValue = "World") String name) {
    model.addAttribute("name", name);
    SystemUser su = new SystemUser(1, "luis", "123");
    model.addAttribute("su", su);
    return "greeting";
}

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

@RequestMapping(value = "/quotes", method = RequestMethod.GET)
public String listQuotes(Model model) {
    model.addAttribute("quote", new Quote());
    model.addAttribute("listQuotes", this.quoteService.listQuotes());
    return "quotes";
}

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

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

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

@RequestMapping(params = "part=category-edit-form")
public String partCategoryEditForm(@PathVariable String language, @RequestParam long id, Model model) {
    model.addAttribute("categoryNodes", categoryUtils.getNodes(true));
    model.addAttribute("category", categoryService.getCategoryById(id, language));
    return "category/index::category-edit-form";
}

From source file:com.devnexus.ting.web.controller.TrackController.java

public void prepareData(Event event, final Model model) {
    model.addAttribute("contextEvent", event);
    final TrackList trackList = new TrackList();
    trackList.setTracks(businessService.getTracksForEvent(event.getId()));
    model.addAttribute("trackList", trackList);
    final List<Presentation> presentations = businessService
            .getPresentationsForEventOrderedByName(event.getId());
    int unassigned = 0;
    for (Presentation presentation : presentations) {
        if (presentation.getTrack() == null) {
            unassigned++;/*from w  ww  .  j a v a 2s  . co m*/
        }
    }
    model.addAttribute("unassignedSessions", unassigned);
}

From source file:com.ecto.engine.controllers.ArticleController.java

@RequestMapping(value = "/article/{a}", method = RequestMethod.GET)
public String getArticle(@PathVariable Integer a, Model model) {
    Article article = articleService.findById(a);
    model.addAttribute("article", article);
    return "article";
}

From source file:com.hendisantika.pasien.controller.AlamatController.java

@RequestMapping(value = { "/alamat", "/savealamat" }, method = RequestMethod.GET)
public String savePage(Model model) {
    model.addAttribute("alamat", new Alamat());
    model.addAttribute("allAlamats", (Collection<Alamat>) alamatService.getAllAlamats());
    return "alamat";
}

From source file:edu.byu.softwareDistribution.web.controller.ListingController.java

@RequestMapping("/products")
public @ModelAttribute("products") List<Product> products(Model model) {
    model.addAttribute("signedInName", IdentityDetails.getCurrentIdentityDetails().getName());
    return productDao.findAll();
}

From source file:edu.byu.softwareDistribution.web.controller.ListingController.java

@RequestMapping("/vendors")
public @ModelAttribute("vendors") List<Vendor> vendors(Model model) {
    model.addAttribute("signedInName", IdentityDetails.getCurrentIdentityDetails().getName());
    return vendorDao.findAll();
}