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:kievreclama.task.controllers.PostController.java

@RequestMapping
public String getPagePost(Model model) {
    model.addAttribute("position", postSercice.getList("posts"));
    return "post";
}

From source file:com.archive.spring.ImageController.java

@RequestMapping(value = "/SpringMVCHibernate/addImage", method = RequestMethod.GET)
public String addImage(Model model) {
    model.addAttribute("addImage", new Image());
    return "addImage";
}

From source file:com.pablinchapin.planz.dailytaskmanager.client.controller.TaskController.java

@RequestMapping(method = RequestMethod.GET)
public String findAll(Model model) {
    model.addAttribute("taskes", service.findAll());
    model.addAttribute("newTask", new TaskServiceDTO());

    return "tasks";
}

From source file:controller.StudentsController.java

@RequestMapping("edit/{id}")
public String editStudent(@PathVariable("id") int id, Model model) {
    model.addAttribute("student", this.studentsService.getStudentById(id));
    model.addAttribute("listStudents", this.studentsService.listStudents());

    return "students";
}

From source file:de.dominikschadow.javasecurity.controller.IndexController.java

@GetMapping("/")
public String index(Model model) {
    model.addAttribute("indirectReferences", resourceService.getAllIndirectReferences());

    return "index";
}

From source file:cn.aozhi.songify.web.account.UserAdminController.java

@RequestMapping(value = "update/{id}", method = RequestMethod.GET)
public String updateForm(@PathVariable("id") Long id, Model model) {
    model.addAttribute("user", accountService.getUser(id));
    return "account/adminUserForm";
}

From source file:com.archive.spring.ImageController.java

@RequestMapping(value = "/image", method = RequestMethod.GET)
public String listImages(Model model) {
    model.addAttribute("image", new Image());
    model.addAttribute("listImages", this.imageService.getAllImages());
    return "image";
}

From source file:com.diguage.wanwan.web.account.UserAdminController.java

@RequestMapping(value = "update/{id}", method = RequestMethod.GET)
public String updateForm(@PathVariable("id") Integer id, Model model) {
    model.addAttribute("user", accountService.getUser(id));
    return "account/adminUserForm";
}

From source file:com.liferay.docs.springmvc.PortletViewController.java

@RenderMapping
public String question(Model model) {
    model.addAttribute("releaseInfo", ReleaseInfo.getReleaseInfo());

    // Test a service tracker
    if (!serviceTracker.isEmpty()) {

        UserLocalService userLocalService = (UserLocalService) serviceTracker.getService();
        int count = userLocalService.getUsersCount();
        System.out.println(count);
    }// w  w w .  j av a2 s .com
    return "test-springmvc-portlet/view";
}

From source file:com.mobileman.projecth.web.controller.admin.AdminPatientsController.java

/**
 * @param request//w  w w . j  av  a  2 s  .c  o  m
 * @param response
 * @param model
 * @return String
 */
@RequestMapping(method = RequestMethod.GET, value = "/admin/patients")
public String patientsGet(HttpServletRequest request, HttpServletResponse response, Model model) {
    model.addAttribute("patients", getPatients());
    return "admin/patients";
}