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:com.juliuskrah.multipart.web.UserController.java

@GetMapping("/profile")
public String index(Model model) {
    model.addAttribute("account", new Account());

    return "profile";
}

From source file:com.kdubb.socialshowcaseboot.HomeController.java

@RequestMapping("/")
public String home(Principal currentUser, Model model) {
    model.addAttribute("connectionsToProviders", getConnectionRepository().findAllConnections());
    model.addAttribute(accountRepository.findAccountByUsername(currentUser.getName()));
    return "home";
}

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

@RequestMapping(value = "/ingresar", method = RequestMethod.GET)
public String ingresar(@RequestParam String nombre, Model modelo) {
    modelo.addAttribute("nombre", nombre);
    return "ingreso";
}

From source file:guru.springframework.controllers.LicenseController.java

@RequestMapping("license/{id}")
public String showLicense(@PathVariable Integer id, Model model) {
    model.addAttribute("license", licenseService.getLicenseById(id));
    return "licenseshow";
}

From source file:guru.springframework.controllers.LicenseController.java

@RequestMapping("license/edit/{id}")
public String edit(@PathVariable Integer id, Model model) {
    model.addAttribute("license", licenseService.getLicenseById(id));
    return "licenseform";
}

From source file:org.esupportail.crousannonces.controllers.AboutController.java

@RenderMapping
public String about(RenderRequest req, Model model) {

    model.addAttribute("isLokavizActivate", isLokavizActivate);
    model.addAttribute("isJobavizActivate", isJobavizActivate);
    model.addAttribute("contextPath", req.getContextPath());
    return "about";
}

From source file:pl.com.softproject.diabetyk.web.controller.UserController.java

@RequestMapping("/register")
public String showRegistrationForm(Model model) {
    model.addAttribute("user", new UserDTO());

    return "register";
}

From source file:ThuaDatControllers.FormControllers.java

/**
 * chuyen den trang thua dat// www.  ja va  2s .  c  o  m
 * @param model
 * @return
 */
@RequestMapping(value = "/thuadat", method = RequestMethod.GET)
public ModelAndView printDemoForm(Model model) {
    model.addAttribute("message", "Xin cho cc bn");
    tblThuaDat objThuaDat = new tblThuaDat();
    //        objThuaDat.SHBANDO = 10;
    //        objThuaDat.SHTHUA = 1;
    return new ModelAndView("demoform", "objThuaDat", objThuaDat);
}

From source file:com.erudika.scoold.controllers.ErrorController.java

@GetMapping("/error/{code}")
public String get(@PathVariable String code, HttpServletRequest req, Model model) {
    model.addAttribute("path", "error.vm");
    model.addAttribute("title", utils.getLang(req).get("error.title"));
    model.addAttribute("status", req.getAttribute("javax.servlet.error.status_code"));
    model.addAttribute("reason", req.getAttribute("javax.servlet.error.message"));
    model.addAttribute("code", code);
    return "base";
}

From source file:com.lcw.one.modules.sys.web.TagController.java

/**
 * treeselect.tag/* www. j a  v a2  s .co m*/
 */
@RequiresUser
@RequestMapping("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";
}