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:org.urbantower.j4s.example.springmvc.web.HelloWorldRestController.java

@RequestMapping(name = "/helloworld", method = RequestMethod.GET)
public String helloWorld(Model model) {
    model.addAttribute("message", service.helloWorld());
    return "helloWorld";
}

From source file:ru.ac.ugatu.asu.news.NewsController.java

@RequestMapping("/")
public String actionIndex(@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
        Model model) {

    model.addAttribute("items", this.newsManager.getPagableResults(NewsItem.class.getName(), page));

    return "news/index";
}

From source file:com.dhenton9000.birt.controllers.HomeController.java

@RequestMapping("/")
public String home(Model model) {
    model.addAttribute("appTitle", "Spring Boot");
    return "pages/home";
}

From source file:com.dhenton9000.birt.controllers.HomeController.java

@RequestMapping("/demos")
public String demos(Model model) {
    model.addAttribute("appTitle", "Application Demos");
    return "pages/demos";
}

From source file:com.dhenton9000.birt.controllers.HomeController.java

@RequestMapping("/data")
public String data(Model model) {
    model.addAttribute("appTitle", "Data Models");
    return "pages/data";
}

From source file:com.example.controller.Greeting.java

@RequestMapping("/greeting")
public String greeting(@RequestParam(value = "name", required = false, defaultValue = "World") String name,
        Model model) {

    model.addAttribute("name", name);
    return "greeting";
}

From source file:com.sbtn.spring.controller.HelloWorldController.java

@RequestMapping("/hello")
public String hello(@RequestParam(value = "name", required = false, defaultValue = "World") String name,
        @RequestParam(value = "ln", required = false, defaultValue = "en") String selectedLanguage,
        Model model) {

    model.addAttribute("name", name);
    model.addAttribute("selectedLanguage", selectedLanguage);

    return "helloworld";
}

From source file:org.me.springxml.controllers.HomeController.java

@RequestMapping(value = "/", method = RequestMethod.GET)
public String home(Model model) {
    model.addAttribute("message", "Hello Thymeleaf World!!!");
    return "/index";
}

From source file:org.wallride.web.controller.admin.LoginController.java

@RequestMapping(params = "failed")
public String failed(Model model) {
    model.addAttribute("failed", true);
    return "login";
}

From source file:org.wallride.web.controller.guest.user.LoginController.java

@RequestMapping(params = "failed")
public String failed(Model model) {
    model.addAttribute("failed", true);
    return "user/login";
}