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:project.controllers.WebController.java

@GetMapping({ "", "/", "/home" })
public String index(Model model) {
    model.addAttribute("films", (Iterable<Film>) filmRep.findAll());
    model.addAttribute("series", (Iterable<Serie>) serieRep.findAll());
    return PAGE_INDEX;
}

From source file:com.budiana.irpan.belajar.controller.HaloController.java

@RequestMapping("/halo")
public void haloHtml(@RequestParam(value = "nama", required = false) String nama, Model hasil) {
    hasil.addAttribute("nama", nama);
    hasil.addAttribute("waktu", new Date());
}

From source file:com.dbv.user.LoginController.java

@RequestMapping(value = "/login", method = RequestMethod.POST)
public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String userName,
        Model model) {
    model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, userName);
    return "login";
}

From source file:com.mycompany.warsztat.controller.HomeController.java

/**
 * This metod return view to controller/*from   w  w  w . j  a  v  a2s.c  om*/
 * 
 * @param model
 * @return "welcome" view
 */
@RequestMapping("/")
public String welcome(Model model) {
    model.addAttribute("greeting", "Witaj w aplikacji garaz");
    model.addAttribute("tagline", "Aplikacja jest kompleksowym narzdziem do obsugi warsztatu.");

    return "welcome";
}

From source file:com.ram.portlet.saml.PortletViewController.java

@RenderMapping
public String question(Model model) {
    model.addAttribute("releaseInfo", ReleaseInfo.getReleaseInfo());
    System.out.print("TEST");

    return "saml-portlet/view";
}

From source file:de.asgarbayli.rashad.hbd.controllers.DashboardController.java

@ModelAttribute
public void addAttributes(Model model) {
    model.addAttribute("title", "Dashboard");
    Messages.resetMessage(model);//from w w  w  .  j a v a2 s  . c o m
}

From source file:edu.mum.waa.webstore.controller.ProductController.java

@RequestMapping("/products")
public String getProducts(Model model) {
    model.addAttribute("products", productRepository.getAllProducts());
    return "products";
}

From source file:za.co.dwarfsun.jcmanager.presentation.HomeController.java

@RequestMapping(value = "/x", method = RequestMethod.GET)
public String x(Model model) {
    model.addAttribute("value", "This is <b>X</b>");
    return "index";
}

From source file:za.co.dwarfsun.jcmanager.presentation.HomeController.java

@RequestMapping(value = "/y", method = RequestMethod.GET)
public String y(Model model) {
    model.addAttribute("value", "This is <b>Y</b>");
    return "index";
}

From source file:cn.aozhi.songify.web.account.LoginController.java

@RequestMapping(method = RequestMethod.POST)
public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String userName,
        Model model) {
    model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, userName);
    return "account/login";
}