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.music.web.PagesController.java

@RequestMapping("/stockmusic")
public String stockMusic(Model model) {
    model.addAttribute("packs", packService.getPiecePacks());
    return "stockpacks";
}

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

@RequestMapping(value = "/NasabahUpdate", method = RequestMethod.GET)
public String update(@RequestParam(value = "idnasabah") int idnasabah, Model model) {

    model.addAttribute("title", "Update Nasabah");
    Nasabah nasabah = nasabahDAO.findOne(idnasabah);
    model.addAttribute("nasabahs", nasabah);
    return "nasabah/update";
}

From source file:ltistarter.controllers.OpenController.java

@RequestMapping({ "", "/" })
public String home(HttpServletRequest req, Principal principal, Model model) {
    commonModelPopulate(req, principal, model);
    model.addAttribute("name", "open (no auth)");
    return "home"; // name of the template
}

From source file:com.alehuo.wepas2016projekti.controller.SearchController.java

/**
 * Hakusivu//from w  w w. ja v a2 s. c o  m
 *
 * @param a Autentikointi
 * @param m Malli
 * @param l
 * @return
 */
@RequestMapping(method = RequestMethod.GET)
public String search(Authentication a, Model m, Locale l) {
    m.addAttribute("user", userService.getUserByUsername(a.getName()));
    return "search";
}

From source file:com.hendisantika.pasien.controller.PasienController.java

@RequestMapping(value = { "/", "/savepage" }, method = RequestMethod.GET)
public String savePage(Model model) {
    model.addAttribute("pasien", new Pasien());
    model.addAttribute("allPasiens", (ArrayList<Pasien>) pasienService.getAllPasiens());
    model.addAttribute("allAlamats", (Collection<Alamat>) alamatService.getAllAlamats());
    return "index";
}

From source file:com.mycompany.mvnspringannotation.controller.MainController.java

@RequestMapping(value = "/actors", method = RequestMethod.GET)
public String getActors(Model model) {
    List<Actor> actors = actorService.getAll();

    model.addAttribute("actors", actors);

    return "actorspage";
}

From source file:controller.KlasController.java

@RequestMapping(method = RequestMethod.GET)
public String doGet(Model model) {
    List<Klas> klassen = klasManager.getItems();
    model.addAttribute("klassen", klassen);
    return "klasOverview";

}

From source file:com.aplikasi.penjualan.controller.DataPelangganHtmlController.java

@RequestMapping("/list")
public void daftarDataPelanggan(Model m) {
    m.addAttribute("daftarDataPelanggan", kd.findAll());
}

From source file:com.dub.skoolie.web.controller.system.schedule.templates.SystemSchoolYearTemplateController.java

@RequestMapping(value = "/system/schedule/templates/schoolyear", method = RequestMethod.POST)
public ModelAndView addYearTemplate(@Valid SchoolYearTemplateBean schoolYearTemplateBean, BindingResult result,
        Model model) {
    if (result.hasErrors()) {
        model.addAttribute("schoolYearTemplateBean", schoolYearTemplateBean);
        model.addAttribute("schoolYearTemplateBeans", uiSchoolYearTemplateServiceImpl.getSchoolYearTemplates());
        return new ModelAndView("system/schedule/templates/schoolyear");
    }/*from   w ww  .j  ava2 s  . co m*/
    uiSchoolYearTemplateServiceImpl.addSchoolYearTemplate(schoolYearTemplateBean);
    return new ModelAndView("redirect:/system/schedule/templates/schoolyear");
}

From source file:com.sivalabs.jcart.site.web.controllers.CartController.java

@GetMapping(value = "/cart")
public String showCart(HttpServletRequest request, Model model) {
    Cart cart = getOrCreateCart(request);
    model.addAttribute("cart", cart);
    return "cart";
}