Example usage for org.springframework.ui ModelMap addAttribute

List of usage examples for org.springframework.ui ModelMap addAttribute

Introduction

In this page you can find the example usage for org.springframework.ui ModelMap addAttribute.

Prototype

public ModelMap addAttribute(String attributeName, @Nullable Object attributeValue) 

Source Link

Document

Add the supplied attribute under the supplied name.

Usage

From source file:cz.muni.fi.mir.controllers.UserRoleController.java

@RequestMapping(value = { "/edit/{id}", "/edit/{id}/" }, method = RequestMethod.GET)
public ModelAndView editUserRole(@PathVariable Long id) {
    ModelMap mm = new ModelMap();
    mm.addAttribute("userRoleForm", mapper.map(userRoleService.getUserRoleByID(id), UserRoleForm.class));

    return new ModelAndView("userrole_edit", mm);
}

From source file:de.berlios.jhelpdesk.web.desktop.DesktopViewController.java

/**
 *
 * @param map/*from  w  ww  .j a va2s.c o m*/
 * @return
 * @throws Exception
 */
@RequestMapping("/desktop/main.html")
public String showDesktop(ModelMap map, HttpSession sess) throws Exception {
    map.addAttribute("lastTickets",
            ticketDAO.getTicketsByStatus(TicketStatus.NOTIFIED, NUMBER_OF_NONASSIGNED_TICKETS));
    map.addAttribute("lastEvents", eventDAO.getLastEvents(NUMBER_OF_EVENTS_IN_DESKTOP));
    map.addAttribute("lastArticles", articleDAO.getLastArticles(NUMBER_OF_LAST_ADDED_ARTICLES));
    map.addAttribute("lastAnnouncements", announcementDAO.getLastAnnouncements(NUMBER_OF_LAST_ANNOUNCEMENTS));
    return "desktop/main";
}

From source file:net.groupbuy.controller.admin.ParameterGroupController.java

/**
 * /*  w ww.j  a va  2s.co m*/
 */
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Long id, ModelMap model) {
    model.addAttribute("parameterGroup", parameterGroupService.find(id));
    model.addAttribute("productCategoryTree", productCategoryService.findTree());
    return "/admin/parameter_group/edit";
}

From source file:net.groupbuy.plugin.file.FileController.java

/**
 * /*from   w w w . j a va2  s.  c  o m*/
 */
@RequestMapping(value = "/setting", method = RequestMethod.GET)
public String setting(ModelMap model) {
    PluginConfig pluginConfig = filePlugin.getPluginConfig();
    model.addAttribute("pluginConfig", pluginConfig);
    return "/net/shopxx/plugin/file/setting";
}

From source file:org.dawnsci.marketplace.controllers.AbstractController.java

protected void addCommonItems(ModelMap map, Principal principal) {
    map.addAttribute("title", environment.getProperty("marketplace.title"));
    map.addAttribute("footer", environment.getProperty("marketplace.footer"));
    map.addAttribute("typeUtilities", DATE_UTILS);
    addProfile(map, principal);/*w ww  . j av a2s  .  c om*/
}

From source file:cz.muni.fi.mir.controllers.UserRoleController.java

@RequestMapping(value = { "/", "/list", "/list/" }, method = RequestMethod.GET)
@SiteTitle("{navigation.userrole.list}")
public ModelAndView list() {
    ModelMap mm = new ModelMap();
    mm.addAttribute("userRoleList", userRoleService.getAllUserRoles());

    return new ModelAndView("userrole_list", mm);
}

From source file:cz.muni.fi.mir.controllers.UserRoleController.java

@RequestMapping(value = { "/create", "/create/" }, method = RequestMethod.GET)
@SiteTitle("{navigation.userrole.create}")
public ModelAndView createUserRole() {
    ModelMap mm = new ModelMap();
    mm.addAttribute("userRoleForm", new UserRoleForm());

    return new ModelAndView("userrole_create", mm);
}

From source file:net.groupbuy.controller.shop.BrandController.java

/**
 * /*from ww  w.j ava 2 s . c o  m*/
 */
@RequestMapping(value = "/list/{pageNumber}", method = RequestMethod.GET)
public String list(@PathVariable Integer pageNumber, ModelMap model) {
    Pageable pageable = new Pageable(pageNumber, PAGE_SIZE);
    model.addAttribute("page", brandService.findPage(pageable));
    return "/shop/brand/list";
}

From source file:org.imsglobal.basiclti.provider.admintool.OauthAdmin.java

@RequestMapping(value = "/admin.html")
public String admin(ModelMap modelMap) {
    modelMap.addAttribute("secrets", consumerSecretService.searchOauthConsumerSecrets());
    return "admin";
}

From source file:com.amediamanager.controller.UserController.java

@RequestMapping(value = "/user", method = RequestMethod.GET)
public String userGet(ModelMap model, HttpSession session) {
    model.addAttribute("templateName", "user");
    return "base";
}