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:jungle.controller.GenreController.java

@RequestMapping(value = "lister", method = RequestMethod.GET)
public String lister(Model m) {

    m.addAttribute("genres", genreCrudService.findAll());

    return "genre/lister";
}

From source file:xyz.autumnn.exam.springsocial.controller.HomeController.java

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

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

@GetMapping
public String get(HttpServletRequest req, Model model) {
    model.addAttribute("path", "about.vm");
    model.addAttribute("title", utils.getLang(req).get("about.title"));
    return "base";
}

From source file:com.kdubb.socialshowcaseboot.facebook.FacebookPhotosController.java

@RequestMapping(value = "/facebook/album/{albumId}", method = RequestMethod.GET)
public String showAlbum(@PathVariable("albumId") String albumId, Model model) {
    model.addAttribute("album", facebook.mediaOperations().getAlbum(albumId));
    model.addAttribute("photos", facebook.mediaOperations().getPhotos(albumId));
    return "facebook/album";
}

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

@RequiresPermissions("sys:dict:view")
@RequestMapping(value = "form")
public String form(String id, Model model) {
    model.addAttribute("id", id);
    return "modules/sys/dictForm";
}

From source file:com.realdolmen.rdfleet.webmvc.controllers.fleet.CompanyCarManagementController.java

@RequestMapping(value = "/{employeeCarLicensePlate}", method = RequestMethod.GET)
public String viewCompanyCar(@PathVariable("employeeCarLicensePlate") String employeeCarLicensePlate,
        Model model) {
    model.addAttribute("employeeCar",
            employeeCarService.findEmployeeCarByLicensePlate(employeeCarLicensePlate));
    return "fleet/companycar.detail";
}

From source file:controller.LightController.java

@RequestMapping(value = { "light" }, method = RequestMethod.GET)
public String showHomePage(Model model) {
    model.addAttribute("lamp", new Lamp());
    try {/* w w  w  .  j  a  v a2  s .  c o  m*/
        model.addAttribute("listLamps", colourService.getAvailableLamps());
    } catch (NullPointerException exception) {
        return "error";
    }
    return "light";
}

From source file:io.spring.marchmadness.controller.TaskController.java

@RequestMapping(value = { "" }, method = RequestMethod.GET)
public String list(Pageable pageable, Model model) {
    model.addAttribute("page", taskExplorer.findAll(pageable));

    return "task/list";
}

From source file:io.spring.marchmadness.controller.TaskController.java

@RequestMapping(value = { "/{id}" }, method = RequestMethod.GET)
public String detail(@PathVariable("id") long id, Model model) {
    model.addAttribute("task", taskExplorer.getTaskExecution(id));

    return "task/detail";
}

From source file:org.home.petclinic2.controller.VetController.java

/**
 * Retrieves view containing list of all vets and their specialties
 * /* w w  w  . jav  a2s . c  o m*/
 * @param model
 * @return
 */
@RequestMapping("/vet")
public String showVetList(Model model) {
    model.addAttribute("vets", clinicService.findVets());
    return "vet/vetList";
}