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:net.groupbuy.controller.admin.BrandController.java

/**
 * //from ww  w. j a v  a  2  s .co m
 */
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Long id, ModelMap model) {
    model.addAttribute("types", Type.values());
    model.addAttribute("brand", brandService.find(id));
    return "/admin/brand/edit";
}

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

/**
 * //from  w w w .  j  ava  2  s .  co m
 */
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Long id, ModelMap model) {
    model.addAttribute("positions", Position.values());
    model.addAttribute("articleCategoryTree", articleCategoryService.findTree());
    model.addAttribute("productCategoryTree", productCategoryService.findTree());
    model.addAttribute("navigation", navigationService.find(id));
    return "/admin/navigation/edit";
}

From source file:com.github.dbourdette.glass.web.interceptor.AddToModelInterceptor.java

@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) throws Exception {
    if (modelAndView == null) {
        return;//  w w w  . ja v a2  s. com
    }

    if (StringUtils.startsWith(modelAndView.getViewName(), "redirect:")) {
        return;
    }

    ModelMap model = modelAndView.getModelMap();

    model.addAttribute("standby", quartzScheduler.isInStandbyMode());
    model.addAttribute("root", configuration.getRoot());
    model.addAttribute("current", URLEncoder.encode(request.getRequestURI(), "UTF-8"));
    model.addAttribute("utils", utilsTool);
    model.addAttribute("format", formatTool);
    model.addAttribute("version", version);
}

From source file:videoshop.controller.CatalogController.java

@RequestMapping("/dvdCatalog")
public String dvdCatalog(ModelMap modelMap) {

    modelMap.addAttribute("catalog", videoCatalog.findByType(DiscType.DVD));
    modelMap.addAttribute("title", messageSourceAccessor.getMessage("catalog.dvd.title"));

    return "discCatalog";
}

From source file:de.berlios.jhelpdesk.web.manager.users.UserController.java

/**
 * Wywietla dane uytkownika na podstawie dostarczonego identyfikatora.
 *
 * @param userId identyfikator uytkownika
 * @param map modelu widoku/*from ww w . j  a v  a2 s. c om*/
 * @return identyfikator widoku prezentujcego uytkownika
 */
@RequestMapping("/manage/users/{id}/show.html")
public String showUser(@PathVariable("id") Long userId, ModelMap map) {
    try {
        map.addAttribute("user", userDAO.getById(userId));
    } catch (DAOException ex) {
        log.error("Komunikat....", ex);
        throw new RuntimeException(ex);
    }
    return "manager/users/show";
}

From source file:de.berlios.jhelpdesk.web.manager.users.UserController.java

/**
 * Wywietla pen list uytkownikw./*from ww w.j ava2  s .c o m*/
 * TODO: stronicowanie
 *
 * @param map model widoku
 * @return identyfikator widoku prezentujcego list uytkownikw
 */
@RequestMapping("/manage/users/list.html")
public String showAllUsers(ModelMap map) {
    try {
        map.addAttribute("users", userDAO.getAllUsers());
    } catch (DAOException ex) {
        log.error("Komunikat....", ex);
        throw new RuntimeException(ex);
    }
    return "manager/users/showAll";
}

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

/**
 * ?//from w w w  .j  a v  a2s  .com
 */
@RequestMapping(value = "/build", method = RequestMethod.GET)
public String build(ModelMap model) {
    model.addAttribute("buildTypes", BuildType.values());
    return "/admin/index/build";
}

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

/**
 * /*from  w  ww  .j a  v a 2 s  . c o m*/
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(Pageable pageable, ModelMap model) {
    model.addAttribute("page", paymentMethodService.findPage(pageable));
    return "/admin/payment_method/list";
}

From source file:de.ingrid.iplug.excel.controller.SettingsController.java

/**
 * Add DocumentType into ModelMap. //  w  ww  .  j  a va 2s. c  o  m
 * 
 * @param model
 * @param sheet
 * @return
 *       Web request "/iplug-pages/settings"
 */
@RequestMapping(value = "/iplug-pages/settings.html", method = RequestMethod.GET)
public String settings(final ModelMap model, @ModelAttribute("sheet") final Sheet sheet) {
    model.addAttribute("documentTypes", DocumentType.values());
    return "/iplug-pages/settings";
}

From source file:edu.ijse.tcd.controller.SignInController.java

@RequestMapping(value = "signIn", method = RequestMethod.GET)
public String loadSignIn(ModelMap map) {
    User user = new User();
    map.addAttribute("userMap", user);
    return "signIn";
}