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:org.openmrs.module.systemmetrics.web.controller.SystemPerformanceandUtilizationManageController.java

@RequestMapping(value = "/module/systemmetrics/usedMemoryChart", method = RequestMethod.GET)
public void chart(ModelMap model) {
    model.addAttribute("user", Context.getAuthenticatedUser());
    PerformanceMonitoringService service = PerformanceMonitoringUtils.getService();
    // We get the memory data in the previous minute to display in the graph
    List<MetricValue> valueList = service.getMetricValuesForChart(System.currentTimeMillis() - 120000,
            System.currentTimeMillis());
    String dataToGraph = PerformanceMonitoringUtils.prepareDataToGraph(valueList);
    model.addAttribute("values", dataToGraph);
    List<PerMinMetricValue> perMinValueList = service
            .getPerMinMetricValuesForChart(System.currentTimeMillis() - 1200000, System.currentTimeMillis());
    String perMinDataToGraph = PerformanceMonitoringUtils.preparePerMinDataToGraph(perMinValueList);
    model.addAttribute("perMinValues", perMinDataToGraph);

}

From source file:abid.password.springmvc.controller.LoginController.java

@RequestMapping(method = RequestMethod.GET, value = "/loginfailed")
public String handleGetLoginError(ModelMap model) {
    List<User> users = userService.getUsers();
    model.addAttribute("users", users);
    model.addAttribute("error", true);
    return "login";
}

From source file:br.com.edo.atmlist.controller.ATMController.java

@RequestMapping(value = { "/" }, method = RequestMethod.GET)
public String login(ModelMap model) {
    model.addAttribute("greeting", "ING ATM");
    return "home";
}

From source file:br.com.edo.atmlist.controller.ATMController.java

@RequestMapping(value = { "/home" }, method = RequestMethod.GET)
public String home(ModelMap model) {
    model.addAttribute("greeting", "ING ATM");
    return "home";
}

From source file:com.citrix.cpbm.portal.fragment.controllers.SupportController.java

private void setCustomPage(ModelMap map, String level2Constant) {
    setPage(map, Page.SUPPORT_HOME);//  w  ww  . j  av  a 2 s  . c  om
    map.addAttribute(level2Constant, "on");
}

From source file:de.berlios.jhelpdesk.web.HelpViewController.java

/**
 * Obsuguje przegldanie bazy wiedzy dziau wsparcia.
 *
 * @param map model widoku/*from  w ww.ja  v a 2  s .  c o m*/
 * @return identyfikator widoku
 */
@RequestMapping(value = "/help/kb/index.html", method = RequestMethod.GET)
public String knowledgeBaseView(ModelMap map) {
    map.addAttribute("categories", articleCategoryDAO.getAllCategories());
    map.addAttribute("latest", articleDAO.getLastArticles(NUM_OF_LAST_ADDED_ARTICLES));
    return HELP_KB_INDEX;
}

From source file:dicky.controlleradmin.MainController.java

@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login(@RequestParam(value = "error", required = false) String error,
        @RequestParam(value = "logout", required = false) String logout, ModelMap modelMap) {

    if (error != null) {
        modelMap.addAttribute("msg", "Invalid Username and Password");
    }// ww  w . j a  v  a 2  s . c  o m

    if (logout != null) {
        modelMap.addAttribute("msg", "You've been logged out successfully");
    }
    return "admin.main.login";
}

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

/**
 * /*w w w  .  j a  v a  2s . c o  m*/
 */
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Long id, ModelMap model) {
    model.addAttribute("types", Type.values());
    model.addAttribute("friendLink", friendLinkService.find(id));
    return "/admin/friend_link/edit";
}

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

/**
 * //from w  ww.  j a v  a2s  .c om
 */
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public String edit(Long id, ModelMap model) {
    model.addAttribute("role", roleService.find(id));
    return "/admin/role/edit";
}

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

/**
 * //from  w w  w.jav a  2s.co m
 */
@RequestMapping(value = "/list", method = RequestMethod.GET)
public String list(Pageable pageable, ModelMap model) {
    model.addAttribute("page", roleService.findPage(pageable));
    return "/admin/role/list";
}