---
title: "Tomcat的jsp编译参数"
author: "michaelee"
date: "2012-07-22T22:37:57Z"
tags: []
categories: ["Web前端"]
slug: "tomcat-jsp"
draft: false
lastmod: "2012-07-22T22:37:57Z"
id: 1603811
url: "https://michaelee.iteye.com/blog/1603811"
---

The servlet which implements Jasper is configured using init parameters in your global`$CATALINA_BASE/conf/web.xml`.

- **checkInterval** - If development is false and reloading is true, background compiles are enabled. checkInterval is the time in seconds between checks to see if a JSP page needs to be recompiled. Default `300` seconds.
- **compiler** - Which compiler Ant should use to compile JSP pages. See the Ant documentation for more information. If the value is not set, then the default Eclipse JDT Java compiler will be used instead of using Ant. No default value.
- **classdebuginfo** - Should the class file be compiled with debugging information? `true` or `false`, default `true`.
- **classpath** - What class path should I use while compiling generated servlets? By default the classpath is created dynamically based on the current web application.
- **compilerSourceVM** - What JDK version are the source files compatible with? (Default JDK 1.4)
- **compilerTargetVM** - What JDK version are the generated files compatible with? (Default JDK 1.4)
- **development** - Is Jasper used in development mode (will check for JSP modification on every access)? `true` or`false`, default `true`.
- **enablePooling** - Determines whether tag handler pooling is enabled. `true` or `false`, default `true`.
- **engineOptionsClass** - Allows specifying the Options class used to configure Jasper. If not present, the default EmbeddedServletOptions will be used.
- **ieClassId** - The class-id value to be sent to Internet Explorer when using &lt;jsp:plugin&gt; tags. Default`clsid:8AD9C840-044E-11D1-B3E9-00805F499D93`.
- **fork** - Have Ant fork JSP page compiles so they are performed in a seperate JVM from Tomcat? `true` or `false`, default `true`.
- **javaEncoding** - Java file encoding to use for generating java source files. Default `UTF8`.
- **genStrAsCharArray** - Should text strings be generated as char arrays, to improve performance in some cases? Default `false`.
- **keepgenerated** - Should we keep the generated Java source code for each page instead of deleting it? `true` or`false`, default `true`.
- **mappedfile** - Should we generate static content with one print statement per input line, to ease debugging? `true`or `false`, default `true`.
- **modificationTestInterval** - Checks for modification for a given JSP file (and all its dependent files) will be performed only once every specified amount of seconds. Setting this to 0 will cause the JSP to be checked on every access. Default is `4` seconds.
- **reloading** - Should Jasper check for modified JSPs? `true` or `false`, default `false`.
- **scratchdir** - What scratch directory should we use when compiling JSP pages? Default is the work directory for the current web application.
- **trimSpaces** - Should white spaces in template text between actions or directives be trimmed ?, default `false`.

 

The Java compiler from Eclipse JDT in included as the default compiler. It is an advanced Java compiler which will load all dependencies from the Tomcat class loader, which will help tremendously when compiling on large installations with tens of JARs. On fast servers, this will allow sub-second recompilation cycles for even large JSP pages. This new compiler will be updated to support the Java 5 syntax as soon as possible.

Apache Ant, which was used in previous Tomcat releases, can be used instead instead of the new compiler by simply removing the `common/lib/jasper-compiler-jdt.jar` file, and placing the `ant.jar` file from the latest Ant distribution in the `common/lib` folder. If you do this, you also need to use the "javac" argument to catalina.sh.