I'm stuck with a problem of displaying an ArrayList
that carries 2750 rows. The Str
uts code to display rows is:
<c:forEach items="${customerlist}" var="beneficiaryListval"varStatus="ForIndex" >
<tr id="<c:out value="${beneficiaryListval.customerId}" />">
<td><c:out value="${beneficiaryListval.fullName}" /></td>
<td><c:out value="${beneficiaryListval.mobileNo}" /></td>
<td><c:out value="${beneficiaryListval.passportNo}" /></td>
<td><c:out value="${beneficiaryListval.beneficiaryCount}" /></td>
</tr>
<%rowID++;%>
</c:forEach>
The action method for this is :
public ActionForward load(ActionMapping actionMapping,ActionForm actionForm,HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
try {
mtmrsLogger.entering("BeneficiaryAction", "load");
BeneficiaryForm beneficiaryForm = (BeneficiaryForm) actionForm;
ArrayList customerlist = customerManager.getCustomerForBeneficiaryWithCount();
httpServletRequest.setAttribute("customerlist", customerlist);
beneficiaryForm.setPageStatus("CustomerGrid");
return actionMapping.findForward(Constants.getInstance().SUCCESS);
}
Now, I need to either break the ArrayList customerlist
and send them to the JSP in chunks of fifty and display, or display them in the JSP, so that it is not very slow while rendering.
Storing 2750 records in a List is not a suggested way. Please consider its implication when you reading it from DB/storage and also when you passing it around on your web/app server. Also you might not need all of them in one go.
Please consider fetching and displaying data in chunks like 100 at one time. You can always make a new call to server to get next set of records by passing index.
Also you will have to use Ajax if you are not using still; this way you can keep appending the remaining data to the page without refreshing.