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:de.dominikschadow.javasecurity.sessionhandling.controller.GreetingController.java

@GetMapping("admin/admin")
public String greetAdmin(Model model) {
    model.addAttribute("greeting", greetingService.greetAdmin());

    return "admin/admin";
}

From source file:kwashc.blog.controller.BlogController.java

@RequestMapping(value = { "/", "/blog" }, method = RequestMethod.GET)
public String showBlog(Model model) {
    model.addAttribute("comments", Database.getComments());
    return "blog";
}

From source file:name.bpdp.bootswipl.BootSwiplController.java

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

    model.addAttribute("resultProps", "nggambleh");
    model.addAttribute("name", name);

    SwiProlog lmSwi = new SwiProlog("src/main/prolog/family.pl", "child_of(joe,X).");

    model.addAttribute("resultSwi", lmSwi.getSolutionResult());

    return "bootswipl-main";
}

From source file:org.cleverbus.admin.web.console.LoginController.java

@RequestMapping(value = "/" + VIEW_NAME, method = RequestMethod.GET)
public String login(@RequestParam(value = "error", required = false) String error,
        @RequestParam(value = "logout", required = false) String logout, Model model) {

    model.addAttribute("badCredentials", error != null);
    model.addAttribute("successLogout", logout != null);

    return VIEW_NAME;

}

From source file:sample.web.category.CategoryController.java

@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public String category(@PathVariable("id") String id, Model model) {
    model.addAttribute("category", categoryService.getCategory(id));
    model.addAttribute("productList", productService.getProductListByCategory(id));
    return "category/list";
}

From source file:sample.web.product.ProductController.java

@RequestMapping(value = "/{productId}", method = RequestMethod.GET)
public String product(@PathVariable("productId") String productId, Model model) {
    model.addAttribute("product", productService.getProduct(productId));
    model.addAttribute("itemList", itemService.getItemsByProduct(productId));
    return "product/list";
}

From source file:com.ai.bss.webui.security.UserController.java

@RequestMapping(method = RequestMethod.GET)
public String showUsers(Model model) {
    model.addAttribute("items", userRepository.findAll());
    return "user/list";
}

From source file:com.ai.bss.webui.security.UserController.java

@RequestMapping(value = "/{identifier}", method = RequestMethod.GET)
public String detail(@PathVariable("identifier") String userIdentifier, Model model) {
    model.addAttribute("item", userRepository.findByIdentifier(userIdentifier));
    return "user/detail";
}

From source file:com.yuga.ygplatform.modules.sys.web.TagController.java

/**
 * treeselect.tag/*  w  ww.  j  ava2s.co m*/
 */
@RequestMapping(value = "treeselect")
public String treeselect(HttpServletRequest request, Model model) {
    model.addAttribute("url", request.getParameter("url")); // ?URL
    model.addAttribute("extId", request.getParameter("extId")); // ?ID
    model.addAttribute("checked", request.getParameter("checked")); // ???
    model.addAttribute("selectIds", request.getParameter("selectIds")); // ID
    model.addAttribute("module", request.getParameter("module")); // ?CMSCategory
    return "modules/sys/tagTreeselect";
}

From source file:eu.gyza.eap.eapsocialontology.ontology.SocialOntologyController.java

@RequestMapping(value = "/ontology/msgs/{msgtype}", method = RequestMethod.GET)
public String messages(@PathVariable String msgtype, Model model) {
    model.addAttribute("friendMessages", ontology.getFriendMessages(msgtype));
    model.addAttribute("msgtype", msgtype);

    return "ontology/showmsgs";
}