Chapter 13 Configuring Jasper 2 JSP Engine

Tomcat utilizes the Jasper 2 JSP Engine in implementing the Java Server Pages 2.0 specification.

Jasper 2 performs faster and better than Jasper. The following lists the features supported by Jasper 2:

  • JSP Custom Tag Pooling – To significantly enhance the performance of JSP pages that uses custom tags, Jasper 2 allows you to pool and reuse the java objects instantiated for JSP Custom Tags.
  • Background JSP Compilation – Jasper 2 can recompile a previously compiled and updated JSP page in the background.
  • Recompile JSP including page changes – When a JSP page is being updated and included at compile time, Jasper 2 detects this page and recompiles the parent JSP.
  • Use JDT to compile JSP pages – Use the Eclipse JDT Java compiler to perform JSP Java Source Code compilation.

Configuring Jasper 2 JSP Engine

By default, Jasper is configured for use in web application development. The servlet implementing Jasper is configured with the use of init parameters in the global $CATALINA_BASE/conf/web.xml.

  • checkInterval – Background compiles are enabled given that development holds false and reloading holds false.
  • engineOptionsClass – This allows you to specify which Options class are used to configure Jasper.
  • ieClassId- This represents the class-id value that should be sent to Internet Explorer when using tags.
  • fork – This queries if an Ant Fork JSP page is compiled.
  • javaEncoding – This refers to a Java file encoding which is used for generating java source files.
  • genStringAsCharArray – This queries if text strings are generates as char arrays.
  • keepgenerated – This queries if generated Java source code for each page is kept.
  • mappedfile – This queries if static content should be generated with one print statement per input line.
  • modificationTestInterval – This checks for modification on a given JSP file which is performed only once every specified amount of time.
  • reloading – This queries if Jasper shpuld check for modified JSPs.
  • scratchdir – This queries on which scratch directory should be used when compiling JSP pages.
  • trimSpaces – This queries if white spaces in template between actions and directives are trimmed.

The default compiler is the Java compiler from Eclipse JDT. This advanced Java compiler loads all dependencies from the Tomcat class loader.


  • Currently 3.08/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
  Flag Inappropriate Content 0 comments