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:wepa.controller.AnimalController.java

public String getRecentAnimals(Model model) {
    model.addAttribute("animals", animalService.getRecentAnimals(10));

    return Routes.ANIMALS_TEMPLATE;
}

From source file:com.hackathon.controller.HelloWorld.java

@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String hello(@RequestParam(value = "name", required = false, defaultValue = "World") String name,
        Model model) {
    model.addAttribute("name", name);
    return "helloworld";
}

From source file:com.onlinebusiness.controller.VendorController.java

@RequestMapping(value = "/admin", method = RequestMethod.GET)
public String addVendor(Model model) {
    model.addAttribute("Vendor", new Vendor());
    return "admin";
}

From source file:com.softserveinc.internetbanking.controller.EmployeeController.java

@RequestMapping("/employee")
public String employee(@RequestParam(value = "name", required = false, defaultValue = "World") String name,
        Model model) {
    model.addAttribute("name", name);
    return "employee";
}

From source file:com.springmvc.videoteca.springtiles.controller.EstrenosController.java

@RequestMapping(value = "/Estrenos", method = RequestMethod.GET)
public String verEstrenos(Model modelo) {
    modelo.addAttribute("estrenos", masVistoService.estrenos());
    return "estrenos";
}

From source file:com.hillert.controller.HelloWorldController.java

@RequestMapping("/")
public String helloWorld(Model model) {
    model.addAttribute("russian", " ");
    return "hello-world";
}

From source file:com.nirwansyah.dicka.springboot.controller.ControllerHome.java

@RequestMapping(value = "/home")
public String index(Model model) {

    model.addAttribute("title", "Home");
    model.addAttribute("tanggal", new Date());
    return "nasabah/home";
}

From source file:com.se.web.ControladorProducto.java

@RequestMapping(value = "/productos")
public String getProductos(Model modelo) {
    modelo.addAttribute("productos", productoFacade.findAll());
    return "/producto/lista";
}

From source file:oobbit.controllers.IndexController.java

@RequestMapping("/")
public String frontPage(Model model) {
    model.addAttribute("roles", users.getCurrentUserRoles());
    return "front";
}

From source file:org.esupportail.pushnotification.controller.AboutController.java

@RenderMapping
public String about(Model model) {

    model.addAttribute("foo", "bar");
    return "about";
}