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.ShippingMethodController.java

/**
 * /*from www.j av  a 2s . c  o  m*/
 */
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Long id, ModelMap model) {
    model.addAttribute("deliveryCorps", deliveryCorpService.findAll());
    model.addAttribute("shippingMethod", shippingMethodService.find(id));
    return "/admin/shipping_method/edit";
}

From source file:org.openmrs.module.systemmetrics.web.controller.SystemPerformanceandUtilizationManageController.java

@RequestMapping(value = "/module/systemmetrics/loggedInUsers", method = RequestMethod.GET)
public void countLogins(ModelMap model) {
    model.addAttribute("user", Context.getAuthenticatedUser());
    PerformanceMonitoringService service = PerformanceMonitoringUtils.getService();
    // We get the login data in the previous 5 minute to display in the graph
    List<LoginValue> valueList = service.getLoginValuesForChart(System.currentTimeMillis() - 300000,
            System.currentTimeMillis());
    String dataToGraph = PerformanceMonitoringUtils.prepareLoginDataToGraph(valueList);
    model.addAttribute("logInValues", dataToGraph);
    // We get the login data in the previous hour to display in the graph
    List<PerMinLoginValue> hourlyValueList = service
            .getPerMinLoginValuesForChart(System.currentTimeMillis() - 3600000, System.currentTimeMillis());
    String hourlyDataToGraph = PerformanceMonitoringUtils.prepareHourlyLoginDataToGraph(hourlyValueList);
    model.addAttribute("perMinLogInValues", hourlyDataToGraph);

}

From source file:org.openmrs.module.clinicalsummary.web.controller.reminder.ReminderListController.java

@RequestMapping(method = RequestMethod.GET)
public void populatePage(final ModelMap map) {
    map.addAttribute("displayTypes", Arrays.asList(ReportDisplayType.DISPLAY_REPORT_BY_PROVIDER,
            ReportDisplayType.DISPLAY_REPORT_BY_LOCATION));
}

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

/**
 * /* w  w w.j a v  a2s  .  com*/
 */
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String add(Long parentId, ModelMap model) {
    model.addAttribute("parent", areaService.find(parentId));
    return "/admin/area/add";
}

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

/**
 * // w ww. ja  v  a2s .co m
 */
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Long id, ModelMap model) {
    model.addAttribute("area", areaService.find(id));
    return "/admin/area/edit";
}

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

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

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

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

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

/**
 * /*from   w w w  .jav  a 2  s  .  co  m*/
 */
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String add(ModelMap model) {
    model.addAttribute("positions", Position.values());
    model.addAttribute("articleCategoryTree", articleCategoryService.findTree());
    model.addAttribute("productCategoryTree", productCategoryService.findTree());
    return "/admin/navigation/add";
}

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

/**
 * // ww w.  j  a  v a  2  s  . c  o  m
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(Pageable pageable, ModelMap model) {
    model.addAttribute("topNavigations", navigationService.findList(Position.top));
    model.addAttribute("middleNavigations", navigationService.findList(Position.middle));
    model.addAttribute("bottomNavigations", navigationService.findList(Position.bottom));
    return "/admin/navigation/list";
}

From source file:org.openmrs.module.orderextension.web.controller.OrderExtensionOrderSetFormController.java

/**
 *///w  w  w.  j  a va  2  s.  c  o m
@RequestMapping(value = "/module/orderextension/orderSetForm.form", method = RequestMethod.GET)
public void showOrderSetForm(ModelMap model) {
    model.addAttribute("operators", Operator.values());
}