/** 查询分页信息列表 */ protected <X extends PagerModel> PagerModel selectPageList(Services<X> service, X model) throws Exception { int offset = 0; // 分页偏移量 if (RequestHolder.getRequest().getParameter("pager.offset") != null) { offset = Integer.parseInt(RequestHolder.getRequest().getParameter("pager.offset")); } if (offset < 0) offset = 0; model.setOffset(offset); PagerModel pager = service.selectPageList(model); if (pager == null) { pager = new PagerModel(); } // 计算总页数 pager.setPagerSize((pager.getTotal() + pager.getPageSize() - 1) / pager.getPageSize()); return pager; }
/** 添加用户资源功能到session,为后面权限功能检查做铺垫 */ private void addUserResourceMenusButton(String button) { log.debug("addUserResourceMenusButton.button=" + button); HttpSession session = RequestHolder.getSession(); Map<String, String> buttons = (Map<String, String>) session.getAttribute(ManageContainer.user_resource_menus_button); if (buttons == null) { buttons = new HashMap<String, String>(); // TreeMap<String, String>(); session.setAttribute(ManageContainer.user_resource_menus_button, buttons); } buttons.put(button, button); }
@RequestMapping(value = "save", method = RequestMethod.POST) public String save(@ModelAttribute("e") Menu menu) throws Exception { if (menu.getId() == null || menu.getId().equals("")) { if (menu.getUrl() == null) { menu.setUrl(""); } menuService.insert(menu); } else { menuService.update(menu); } return selectList(RequestHolder.getRequest(), menu); }
package net.jeeshop.web.action.manage.product;
protected CartInfo getMyCart() { return (CartInfo) RequestHolder.getSession().getAttribute(FrontContainer.myCart); }