There must be something else going on here. I ran a simple
test.
***** File: with-jstl.jsp *****
<%@taglib uri="/WEB-INF/c.tld" prefix="c" %>
<html>
<body>
<c:forEach items="${beans}" var="bean">
<c
ut value="Hello, ${bean.first} ${bean.last}!" /><br />
</c:forEach>
</body>
</html>
***** File: with-scriptlets.jsp *****
<%@ page import="java.util.Collection,
java.util.Iterator,
test.domain.TestBean"%>
<html>
<body>
<%
final Collection beans = ( Collection )request.getAttribute( "beans" );
for( Iterator i = beans.iterator(); i.hasNext(); )
{
TestBean bean = ( TestBean ) i.next();
%>
Hello, <%=bean.getFirst()%> <%=bean.getLast()%>!<br />
<%
}
%>
</body>
</html>
***** File: SetupFilter.java *****
public class SetupFilter implements Filter
{
private Collection beans;
public void destroy()
{
}
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException
{
req.setAttribute( "beans", beans );
chain.doFilter( req, resp );
}
public void init( FilterConfig config ) throws ServletException
{
beans = new LinkedList();
for( int i = 0; i < 10000; ++i )
{
beans.add( new TestBean( "First" + i, "Last" + i ) );
}
}
}
***** File: TimingFilter.java *****
public class TimingFilter implements Filter
{
private FilterConfig filterConfig;
public void init( FilterConfig filterConfig ) throws ServletException
{
this.filterConfig = filterConfig;
}
public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain ) throws IOException, ServletException
{
final long before = System.currentTimeMillis();
filterChain.doFilter( servletRequest, servletResponse );
final long after =System.currentTimeMillis();
filterConfig.getServletContext().log( "Request for "+ ( ( HttpServletRequest )servletRequest ).getRequestURI() + " took " + ( after - before ) + " milliseconds." );
}
public void destroy()
{
filterConfig = null;
}
}
Here are some of the results I got using
JBoss 4.0.1 and JDK 1.4.2_06...
18:46:44,973 INFO [Engine] StandardContext[/test-webapp]Request for /test-webapp/with-jstl.jsp took 601 milliseconds.
18:46:46,985 INFO [Engine] StandardContext[/test-webapp]Request for /test-webapp/with-scriptlets.jsp took 530 milliseconds.
18:46:49,279 INFO [Engine] StandardContext[/test-webapp]Request for /test-webapp/with-jstl.jsp took 521 milliseconds.
18:46:51,722 INFO [Engine] StandardContext[/test-webapp]Request for /test-webapp/with-scriptlets.jsp took 480 milliseconds.
18:46:53,725 INFO [Engine] StandardContext[/test-webapp]Request for /test-webapp/with-jstl.jsp took 531 milliseconds.
18:46:55,868 INFO [Engine] StandardContext[/test-webapp]Request for /test-webapp/with-scriptlets.jsp took 400 milliseconds.
18:46:58,161 INFO [Engine] StandardContext[/test-webapp]Request for /test-webapp/with-jstl.jsp took 520 milliseconds.
18:46:59,644 INFO [Engine] StandardContext[/test-webapp]Request for /test-webapp/with-scriptlets.jsp took 471 milliseconds.