Bug 46807

Summary: Cannot disable jsp tag pooling
Product: Tomcat 6 Reporter: Eric Abbott <eabbott>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 6.0.18   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   

Description Eric Abbott 2009-03-05 12:17:24 UTC
Set jvm param -Dorg.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false.
In web.xml set enablePooling to false.

Created a custom tag that extends 
import javax.servlet.jsp.tagext.BodyTagSupport;


Verified by adding member field
private long creation_time = System.currentTimeMillis();

inside doInitBody()...
  public void doInitBody() {
    System.out.println("creation_time="+ creation_time);
  }
Comment 1 Eric Abbott 2009-03-05 14:00:43 UTC
It appears that once a jsp is compiled (pre or live), tag pooling is no longer changeable via web.xml nor the jvm compiler flag.
Comment 2 Eric Abbott 2009-03-05 15:05:32 UTC
http://tomcat.apache.org/tomcat-6.0-doc/jasper-howto.html
The documentation is misleading when it states:
"Use java system property at server runtime to disable tag pooling org.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false. and limit the buffering with org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true. Note that changing from the defaults may affect performance, but it will vary depending on the application."

The pooling for a given jsp can only be determined at compile time, be it precompiled or compiled by the server.  Also the ant jasper precompile task attribute poolingEnabled unfortunately differs from the web.xml value of enablePooling which can cause confusion.
Comment 3 Mark Thomas 2009-03-07 08:16:45 UTC
Sorry for the confusion.

org.apache.jasper.runtime.JspFactoryImpl.USE_POOL controls the pooling of PageContext objects, not tag instances. I have updated the docs to reflect this.

I have also update the docs to make to clear that enablePooling is a compile time option, not a runtime one.

The changes have been applied to trunk and 6.0.x and will be included in 6.0.20 onwards.