我的应用中遇到了问题。我想在我的应用程序中实现一种分页功能,但由于现有的行为,我无法继续使用在我的应用程序中实现分页的标准方法。
问题:我有一个包含所有数据的bean对象。我想设置一个逻辑,将对象分解为50个组。所以考虑一下,如果我的对象中有5000个配置,我将首先将其分解为前50个,同样将在UI上显示。此外,我将不得不通过打破50批次中的重新配置450配置来继续这个过程。任何人都可以建议我如何继续这个逻辑?
我的方法:在我现有的代码中,我正在检查对象的大小。如果是大小数据。如果它超过50.我设置一个标志为真。此标志将在JSP / JS中使用,以重新触发DOJO调用以再次获取数据。请找到代码的片段。
public ActionForward sdconfigLoadServiceGroups(ActionMapping actionMapping,
ActionForm actionForm, HttpServletRequest servletRequest,
HttpServletResponse servletResponse) {
String groupUniqueId = servletRequest.getParameter("groupUniqueId");
Boolean retriggerRequestFlag = false;
// Get the ui group
HashMap sdConfigDetailsHashMap = (HashMap) ((DynaActionForm) actionForm).get(SD_CONFIG_DETAILS);
TreeMap sdConfigTreeMap = (TreeMap) sdConfigDetailsHashMap.get("SDConfigTree");
Boolean viewOnly=(Boolean) sdConfigDetailsHashMap.get("ViewOnly");
Order order = orderManager.getOrder((Long) sdConfigDetailsHashMap.get("OrderId"));
SDConfigUITab sdConfigUITab = sdConfig2Manager.getTabByGroupUniqueId(groupUniqueId, sdConfigTreeMap);
SDConfigUIGroup sdConfigUIGroup = sdConfig2Manager.getGroupByGroupUniqueId(servletRequest.getParameter("groupUniqueId"), sdConfigUITab);
//TODO: Adding logger to check the total number of sections
logger.info("All Sections==="+sdConfigUIGroup.getSections());
logger.info("Total Sections?? "+sdConfigUIGroup.getSections().size());
long size = Long.valueOf(sdConfigUIGroup.getSections().size());
if (size != 0 && size > 50) {
sdConfigUIGroup = loadDynamicConfigs(sdConfigUIGroup);
retriggerRequestFlag = true;
}
servletRequest.setAttribute("retriggerRequest", retriggerRequestFlag);
servletRequest.setAttribute("groupUniqueId", servletRequest.getParameter("groupUniqueId"));
servletRequest.setAttribute("sdConfigUIGroup", sdConfigUIGroup);
servletRequest.setAttribute("sdConfigUITab", sdConfigUITab);
servletRequest.setAttribute("sdConfigUITabId", sdConfigUITab.getTabId());
servletRequest.setAttribute("currentOrderId", order.getOrderId());
servletRequest.setAttribute("viewOnly", viewOnly);
return actionMapping.findForward("sdconfigLoadServiceGroups");
}
public SDConfigUIGroup loadDynamicConfigs(SDConfigUIGroup sdConfigUIGroup) {
//logic for breaking into batches of 50 goes here
}
}
欢迎任何建议:)谢谢!!!
答案 0 :(得分:1)
保持曲目,