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:doan.html5tutorial.demo.mvc.HomeController.java

@RequestMapping(value = { "/", "/home" }, method = RequestMethod.GET)
public String home(Model model) {
    model.addAttribute("books", this.books);
    return "home";

}

From source file:org.hdiv.spring.boot.sample.web.MainController.java

@RequestMapping(value = "/form", method = RequestMethod.GET)
String form(Model model) {

    model.addAttribute("formBean", new FormBean());
    return "form";
}

From source file:org.thymeleaf.presentation.controllers.BlogController.java

/**
 * Places all of the blog posts on the model, returns the JSP view.
 * // w  w  w. j a  va2 s. c o m
 * @param model
 * @return JSP view name.
 */
@RequestMapping(value = "/jsp-example")
public String blogPostsJSP(Model model) {

    model.addAttribute("posts", blogservice.fetchAllPosts());
    return "Blog.jsp";
}

From source file:org.thymeleaf.presentation.controllers.BlogController.java

/**
 * Places all of the blog posts on the model, returns the Thymeleaf view.
 * /*from ww w. j  ava2s .  c o  m*/
 * @param model
 * @return Thymeleaf view name.
 */
@RequestMapping(value = "/thymeleaf-example")
public String blogPostsThymeleaf(Model model) {

    model.addAttribute("posts", blogservice.fetchAllPosts());
    return "Blog.html";
}

From source file:pl.examples.springdm.web.FirstSpringDmController.java

@RequestMapping("/home")
public String home(Model model) {
    model.addAttribute("msg", bean.sayHallo());
    return "home";
}

From source file:ru.trett.cis.controllers.AssetController.java

@RequestMapping(value = "/list")
public String list(Model model) {
    model.addAttribute("object", "Asset");
    return "asset/table";
}

From source file:spring.showcase.form.FrontController.java

@ModelAttribute
public void AddStaticContent(Model model) {
    model.addAttribute("users", list);
}

From source file:com.kodgemisi.web.sample.controller.ItemController.java

@RequestMapping()
public String list(Model model) {
    model.addAttribute("items", this.itemService.getAll());
    return "itemList";
}

From source file:com.solutiondesign.rss.controller.RssFeedController.java

@RenderMapping
public String render(RenderRequest request, Model model) {
    model.addAttribute("allowUserFeed", preferenceService.allowUserFeeds(request));
    model.addAttribute("showActivities", preferenceService.showActivities(request));
    return "view";
}

From source file:org.axonframework.samples.trader.webui.order.OrderBookController.java

@RequestMapping(method = RequestMethod.GET)
public String get(Model model) {
    model.addAttribute("items", repository.findAll());
    return "orderbook/list";
}