Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSTL forEach tag taking longer time than scriplets ???

843836Feb 7 2005 — edited Feb 7 2005
Hi Gurus,

My STRUTS action class setsup a collection object [roughly 900 + records stored as java beans] to be displayed on my view [JSP]. The problem is, when I iterate over this collection in JSP using <c:forEach> tag, it takes around 4-5 minutes to build up the page.

I coded the same looping logic through java scriplets embedded within JSP and the processing came down to 1 minute. Should I assume that <c:forEach> tag will have a processing overhead over plain java code in JSP?

FYI, I checked the server generated SERVLET code under WORK directory of TOMCAT for this JSP with <c:forEach> tag and find lot of code being generated for this <c:forEach> tag implementation. Could it be that the processing of these generated code takes longer than plain java using scriplets?

Please Help.

Thanks,
Karthik.

<b>JSP using <c:forEach></b>
<c:forEach var="refurb" items="${BOMDataForm.refurbSummary}" varStatus="loopStatus">                     
<tr valign="top" bgcolor="#FFFFFF">  
<td> 
<div align="center"><span class="modulecontent"><c:out value="${refurb.configName}" /></span></div>
</td>                      
<td>
<div align="center"><span class="modulecontent"><c:out value="${refurb.itemName}" /></span></div>
</td>
</tr>
</c:forEach>
<b>JSP using embedded scriplets</b>
<%
BOMDataForm bomDataForm = (BOMDataForm) request.getAttribute("BOMDataForm");
ArrayList arrayList = (ArrayList) bomDataForm.getRefurbSummary();
int loop = arrayList.size();
for (int i=0;i<loop;i++) {
out.println("<tr valign=\"top\" bgcolor=\"#FFFFFF\">");
out.println("<td>");
out.println("<div align=\"center\"><span class=\"modulecontent\">");
out.println(((RefurbSearchResult)arrayList.get(i)).getConfigName());
out.println("</span></div>");
out.println("</td>");
out.println("<td>");
out.println("<div align=\"center\"><span class=\"modulecontent\">");
out.println(((RefurbSearchResult)arrayList.get(i)).getItemName());
out.println("</span></div>");
out.println("</td>");
out.println("</tr>");                    	
}
%> 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 7 2005
Added on Feb 7 2005
1 comment
229 views