private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
Table of Contents
This document provides information about configuring JSP.
.jsp files into Java classes, you
need a Java compiler. You can acquire a Java compiler from the JVM if you
are using a full JDK, or from a third party Jar.
By default, the JSP engine Jetty uses tries to use the
compiler that is part of the JDK. NOTE:
when using the JDK compiler, the system does not save your class files to disk unless you use the
saveBytecode init-param as described below.
If you do not have a full JDK, you can configure the JSP engine
to use the Eclipse Java Compiler that Jetty ships in the distro in
$JETTY_HOME/lib/jsp/org.eclipse.jdt.core-3.7.1.jar. You need to
define a SystemProperty that prevents the JSP engine from defaulting to
the in-JVM compiler.
Here is the property definition to add to
Alternatively, you can define this SystemProperty in a
If you are using the Jetty Maven Plugin, you have a number of options:
jetty.xml config file and define the SystemProperty in
Add the SystemProperty definition to Maven's MAVEN_OPTS environment variable.
The JSP engine has many configuration parameters. Some parameters
affect only precompilation, and some affect runtime recompilation
checking. Parameters also differ among the various versions of the JSP
engine. This page lists the configuration parameters, their meanings, and
their default settings. Set all parameters on the
org.apache.jasper.JspServlet instance defined in the
Be careful: for all of these parameters, if the value you set doesn't take effect, try using all lower case instead of camel case, or capitalizing only some of the words in the name, as JSP is inconsistent in its parameter naming strategy.
Table 8.1. Understanding JSP Parameters
|fork||Should Ant fork its Java compiles of JSP pages?||TRUE||FALSE|
|keepgenerated||Do you want to keep the generated Java files around?||FALSE||–|
|saveBytecode||If class files are generated as byte arrays, should they be saved to disk at the end of compilations?||FALSE||–|
|trimSpaces||Should white spaces between directives or actions be trimmed?||FALSE||–|
|enablePooling||Determines whether tag handler pooling is enabled.||TRUE||–|
|mappedFile||Support for mapped Files. Generates a servlet that has a print statement per line of the JSP file./||TRUE||–|
|sendErrorToClient||If false, stack traces, etc., are sent to std error instead of the client's browser.||FALSE||–|
|classdebuginfo||Include debugging info in class file.||TRUE||–|
|checkInterval||Interval in seconds between background recompile checks.
Only relevant if ||0||–|
|suppressSmap||Generation of SMAP info for JSR45 debugging.||FALSE||–|
|dumpSmap||Dump SMAP JSR45 info to a file.||FALSE||–|
|genStrAsCharArray||Option for generating Strings.||FALSE||–|
|genStrAsByteArray||Option for generating Strings.||TRUE||–|
|scratchDir||Directory where servlets are generated. Jetty sets this value according to the [/display/JETTY/Temporary+Directories work dir] settings for the webapp.||–||–|
|compiler||Determined at runtime. For Jetty this is the Eclipse jdt compiler.||–||–|
|compilerTargetVM||Target vm to compile for.||1.5||–|
|compilerSourceVM||Sets source compliance level for the jdt compiler.||1.5||–|
|javaEncoding||Pass through the encoding to use for the compilation.||UTF8||–|
|xpoweredBy||Generate an X-Powered-By response header.||FALSE||FALSE|
|validating/enableTldValidation||Whether or not to validate tag files against the schema.||FALSE||–|
|initial-capacity/initialCapacity||The initial capacity of the hash maps mapping the name of the JSP to class and JSP file.||–||–|
Much confusion generally ensues about the
parameters and JSP runtime recompilation. Here is a factoring out of the
Check the JSP files for possible recompilation on every request:
Only check approximately every N seconds, where a request triggers the time-lapse calculation. This example checks every 60 seconds:
Do no checking whatsoever, but still compile the JSP on the very first hit. (Be aware that this ''reload-interval'' parameter is shorthand for a ''development=false'' and ''checkInterval=0'' combination.):
Don't do any request-time checking, but instead start a background thread to do checks every N seconds. This example checks every 60 seconds:
There are several options for modifying the JspServlet configuration.
You can make a copy of the $JETTY_HOME/etc/webdefault.xml that ships with Jetty, apply your changes, and use it instead of the shipped version. The example below shows how to do this when using the Jetty Maven plugin.
If you are using the Jetty distro, and you want to change the JSP
settings for just one or a few of your webapps, copy the
file somewhere, modify it, and then use a context xml file to
set this file as the defaultsDescriptor for your webapp. Here's a
If you want to change the JSP settings for all webapps, edit
$JETTY_HOME/etc/webdefaults.xml file directly
Another option is to add an entry for the JSPServlet to the
WEB-INF/web.xml file of your webapp. You can use
the entry in $JETTY_HOME/etc/webdefault.xml as a
The JavaServer Pages Standlard Tag Library (JSTL) is part of the
Jetty distribution (in
$JETTY_HOME/lib/jsp) and is
automatically on the classpath.
The following sections provide information about using JSF taglibs with Jetty Standalone and the Jetty Maven Plugin.
If you want to use JSF with your webapp, you need to copy the JSF
implementation Jar (whichever Jar contains the
META-INF/*.tld files from your chosen JSF
$JETTY_HOME/lib/jsp. This is
because the version of the JSP engine from Glassfish that we are using
requires that the JSF tags be on the container's
classpath, and not on the webapp's