Example usage for org.springframework.ui ModelMap addAttribute

List of usage examples for org.springframework.ui ModelMap addAttribute

Introduction

In this page you can find the example usage for org.springframework.ui ModelMap addAttribute.

Prototype

public ModelMap addAttribute(String attributeName, @Nullable Object attributeValue) 

Source Link

Document

Add the supplied attribute under the supplied name.

Usage

From source file:com.example.controllers.About.java

@RequestMapping("/about")
public String getAbout(ModelMap model) {
    model.addAttribute("content", "about");
    return "base";
}

From source file:com.example.controllers.Index.java

@RequestMapping("/")
public String getMainPage(ModelMap model) {
    model.addAttribute("content", "index");
    return "base";
}

From source file:org.nikiforov.karafrestspring.spring.mvc.HelloController.java

@RequestMapping(method = RequestMethod.GET)
public String printHello(ModelMap model) {
    model.addAttribute("message", "Hello Spring MVC Framework!");
    return "hello";
}

From source file:com.dalamar.thewebproject.TstController.java

@RequestMapping(value = "/tst", method = RequestMethod.GET)
public String testIt(ModelMap mdl) {
    mdl.addAttribute("sampleAttribute", "nigger");
    return "tst";
}

From source file:com.example.controllers.Contact.java

@RequestMapping("/contact")
public String getContact(ModelMap model) {
    model.addAttribute("content", "contact");
    return "base";
}

From source file:com.dobri.springldap.HelloController.java

@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String printHello(ModelMap model) {
    model.addAttribute("message", "Hello Spring MVC Framework!");
    return "hello";
}

From source file:com.project.framework.controller.LoginController.java

@GetMapping("/login")
public String setLogIn(ModelMap model) {
    model.addAttribute("logon", new Cuenta());
    return "framework/login";
}

From source file:com.project.framework.controller.RecuperarController.java

@RequestMapping(value = "/recuperar", method = RequestMethod.GET)
public String setRecuperar(ModelMap model) {
    model.addAttribute("recuperar", new Cuenta());
    return "framework/recuperar";
}

From source file:com.project.framework.controller.RegistroController.java

@RequestMapping(value = "/registro", method = RequestMethod.GET)
public String setRegistro(ModelMap model) {
    model.addAttribute("registro", new Cuenta());
    return "framework/registro";
}

From source file:controllers.GreetingController.java

@RequestMapping(value = "/greeting", method = RequestMethod.GET)
public String printHello(@RequestParam(value = "name", required = false, defaultValue = "User") String name,
        ModelMap model) {
    model.addAttribute("message", name + " Spring Hello World!!!!");
    return "Greeting";
}