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.kdubb.socialshowcaseboot.twitter.TwitterSearchController.java

@RequestMapping(value = "/twitter/search", method = RequestMethod.GET)
public String showTrends(@RequestParam("query") String query, Model model) {
    model.addAttribute("timeline", twitter.searchOperations().search(query).getTweets());
    return "twitter/timeline";
}

From source file:com.mysample.controller.BaseController.java

@RequestMapping(value = "/user-list.html", method = RequestMethod.GET)
public String userList(Model model) {

    model.addAttribute("userlist", userRepository.findAllByOrderByUserIdAsc());

    return "user-list";
}

From source file:com.vgorcinschi.concordiafootballmanager.web.PlayerController.java

@RequestMapping(method = RequestMethod.GET)
public String getPlayers(Model model) {
    model.addAttribute("playerList", playerService.getAllPlayers());
    return "allPlayers";
}

From source file:com.vgorcinschi.concordiafootballmanager.web.PlayerController.java

@RequestMapping(value = "/{playerId:\\d+}", method = RequestMethod.GET)
public String getOnePlayer(@PathVariable long playerId, Model model) {
    model.addAttribute("player", playerService.getPlayer(playerId));
    return "playerPage";
}

From source file:ThuaDatControllers.ThuaDatController.java

@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String printHelloWorld(Model model) {
    model.addAttribute("message", "Xin cho cc bn");
    return "hello";
}

From source file:ua.com.codefire.springbootexample.WelcomeController.java

@RequestMapping("/")
public String getRoot(Model model) {
    model.addAttribute("users", userRepo.findAll());

    return "index";
}

From source file:com.github.gabrielruiu.spring.yahoo.sample.controller.HomeController.java

@RequestMapping(method = RequestMethod.GET)
public String contacts(Model model) {
    model.addAttribute("contacts", yahoo.contactsOperations().getContacts());
    return "home";
}

From source file:com.jd.jr.chapter5.pjax.TestController.java

@RequestMapping("/page1")
public String page1(@RequestHeader(value = "layout", defaultValue = "true") boolean layout, Model model) {
    model.addAttribute("layout", layout);
    return "test/page1";
}

From source file:com.jd.jr.chapter5.pjax.TestController.java

@RequestMapping("/page2")
public String page2(@RequestHeader(value = "layout", defaultValue = "true") boolean layout, Model model) {
    model.addAttribute("layout", layout);
    return "test/page2";
}

From source file:com.jd.jr.chapter5.pjax.TestController.java

@RequestMapping("/page3")
public String page3(@RequestHeader(value = "layout", defaultValue = "true") boolean layout, Model model) {
    model.addAttribute("layout", layout);
    return "test/page3";
}