| 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 6.0 - Jasper 2 JSP Engine How To</title><meta value="Glenn L. Nielsen" name="author"><meta value="glenn@apache.org" name="email"><meta value="Peter Rossbach" name="author"><meta value="pero@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt=" | 
|---|
| 2 | The Apache Tomcat Servlet/JSP Container | 
|---|
| 3 | " align="right" src="./../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="./../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Apache Tomcat 6.0</h1><h2>Jasper 2 JSP Engine How To</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Table of Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 4 | <p> | 
|---|
| 5 | <a href="#Introduction">Introduction</a><br> | 
|---|
| 6 | <a href="#Configuration">Configuration</a><br> | 
|---|
| 7 | <a href="#Production Configuration">Production Configuration</a><br> | 
|---|
| 8 | <a href="#Web Application Compilation">Web Application Compilation</a><br> | 
|---|
| 9 | <a href="#Using Jikes">Using Jikes</a><br> | 
|---|
| 10 | </p> | 
|---|
| 11 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 12 |  | 
|---|
| 13 | <p>Tomcat 6.0 uses the Jasper 2 JSP Engine to implement | 
|---|
| 14 | the <a href="http://java.sun.com/products/jsp/">JavaServer Pages 2.0</a> | 
|---|
| 15 | specification.</p> | 
|---|
| 16 |  | 
|---|
| 17 | <p>Jasper 2 has been redesigned to significantly improve performance over | 
|---|
| 18 | the orignal Jasper.  In addition to general code improvements the following | 
|---|
| 19 | changes were made: | 
|---|
| 20 | <ul> | 
|---|
| 21 | <li><strong>JSP Custom Tag Pooling</strong> - The java objects instantiated | 
|---|
| 22 | for JSP Custom Tags can now be pooled and reused.  This significantly boosts | 
|---|
| 23 | the performance of JSP pages which use custom tags.</li> | 
|---|
| 24 | <li><strong>Background JSP compilation</strong> - If you make a change to | 
|---|
| 25 | a JSP page which had already been compiled Jasper 2 can recompile that | 
|---|
| 26 | page in the background.  The previously compiled JSP page will still be | 
|---|
| 27 | available to serve requests.  Once the new page has been compiled | 
|---|
| 28 | successfully it will replace the old page.  This helps improve availablity | 
|---|
| 29 | of your JSP pages on a production server.</li> | 
|---|
| 30 | <li><strong>Recompile JSP when included page changes</strong> - Jasper 2 | 
|---|
| 31 | can now detect when a page included at compile time from a JSP has changed | 
|---|
| 32 | and then recompile the parent JSP.</li> | 
|---|
| 33 | <li><strong>JDT used to compile JSP pages</strong> - The | 
|---|
| 34 | Eclipse JDT Java compiler is now used to perform JSP java source code | 
|---|
| 35 | compilation. This compiler loads source dependencies from the container | 
|---|
| 36 | classloader. Ant and javac can still be used.</li> | 
|---|
| 37 | </ul> | 
|---|
| 38 | </p> | 
|---|
| 39 |  | 
|---|
| 40 | <p>Jasper is implemented using the servlet class | 
|---|
| 41 | <code>org.apache.jasper.servlet.JspServlet</code>.</p> | 
|---|
| 42 |  | 
|---|
| 43 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Configuration"><strong>Configuration</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 44 |  | 
|---|
| 45 | <p>By default Jasper is configured for use when doing web application | 
|---|
| 46 | development.  See the section <a href="#Production Configuration"> | 
|---|
| 47 | Production Configuration</a> for information on configuring Jasper | 
|---|
| 48 | for use on a production Tomcat server.</p> | 
|---|
| 49 |  | 
|---|
| 50 | <p>The servlet which implements Jasper is configured using init parameters | 
|---|
| 51 | in your global <code>$CATALINA_BASE/conf/web.xml</code>. | 
|---|
| 52 |  | 
|---|
| 53 | <ul> | 
|---|
| 54 | <li><strong>checkInterval</strong> - If development is false and checkInterval | 
|---|
| 55 | is greater than zero, background compiles are enabled. checkInterval is the time | 
|---|
| 56 | in seconds between checks to see if a JSP page (and its dependent files) needs | 
|---|
| 57 | to be recompiled. Default <code>0</code> seconds.</li> | 
|---|
| 58 |  | 
|---|
| 59 | <li><strong>classdebuginfo</strong> - Should the class file be compiled with | 
|---|
| 60 | debugging information?  <code>true</code> or <code>false</code>, default | 
|---|
| 61 | <code>true</code>. | 
|---|
| 62 | </li> | 
|---|
| 63 |  | 
|---|
| 64 | <li><strong>classpath</strong> - Defines the class path to be used to compile | 
|---|
| 65 | the generated servlets. This parameter only has an effect if the ServletContext | 
|---|
| 66 | attribute org.apache.jasper.Constants.SERVLET_CLASSPATH is not set. This | 
|---|
| 67 | attribute is always set when Jasper is used within Tomcat. By default the | 
|---|
| 68 | classpath is created dynamically based on the current web application.</li> | 
|---|
| 69 |  | 
|---|
| 70 | <li><strong>compiler</strong> - Which compiler Ant should use to compile JSP | 
|---|
| 71 | pages.  See the Ant documentation for more information. If the value is not set, | 
|---|
| 72 | then the default Eclipse JDT Java compiler will be used instead of using Ant. | 
|---|
| 73 | No default value.</li> | 
|---|
| 74 |  | 
|---|
| 75 | <li><strong>compilerSourceVM</strong> - What JDK version are the source files | 
|---|
| 76 | compatible with? (Default JDK 1.4)</li> | 
|---|
| 77 |  | 
|---|
| 78 | <li><strong>compilerTargetVM</strong> - What JDK version are the generated files | 
|---|
| 79 | compatible with? (Default JDK 1.4)</li> | 
|---|
| 80 |  | 
|---|
| 81 | <li><strong>development</strong> - Is Jasper used in development mode? If true, | 
|---|
| 82 | the frequency at which JSPs are checked for modification may be specified via | 
|---|
| 83 | the modificationTestInterval parameter.<code>true</code> or <code>false</code>, | 
|---|
| 84 | default <code>true</code>.</li> | 
|---|
| 85 |  | 
|---|
| 86 | <li><strong>displaySourceFragment</strong> - Should a source fragment be | 
|---|
| 87 | included in exception messages? <code>true</code> or <code>false</code>, | 
|---|
| 88 | default <code>true</code>.</li> | 
|---|
| 89 |  | 
|---|
| 90 | <li><strong>dumpSmap</strong> - Should the SMAP info for JSR45 debugging be | 
|---|
| 91 | dumped to a file? <code>true</code> or <code>false</code>, default | 
|---|
| 92 | <code>false</code>. <code>false</code> if suppressSmap is true.</li> | 
|---|
| 93 |  | 
|---|
| 94 | <li><strong>enablePooling</strong> - Determines whether tag handler pooling is | 
|---|
| 95 | enabled. <code>true</code> or <code>false</code>, default <code>true</code>. | 
|---|
| 96 | </li> | 
|---|
| 97 |  | 
|---|
| 98 | <li><strong>engineOptionsClass</strong> - Allows specifying the Options class | 
|---|
| 99 | used to configure Jasper. If not present, the default EmbeddedServletOptions | 
|---|
| 100 | will be used. | 
|---|
| 101 | </li> | 
|---|
| 102 |  | 
|---|
| 103 | <li><strong>errorOnUseBeanInvalidClassAttribute</strong> - Should Jasper issue | 
|---|
| 104 | an error when the value of the class attribute in an useBean action is not a | 
|---|
| 105 | valid bean class? <code>true</code> or <code>false</code>, default | 
|---|
| 106 | <code>true</code>.</li> | 
|---|
| 107 |  | 
|---|
| 108 | <li><strong>fork</strong> - Have Ant fork JSP page compiles so they are | 
|---|
| 109 | performed in a seperate JVM from Tomcat? <code>true</code> or | 
|---|
| 110 | <code>false</code>, default <code>true</code>.</li> | 
|---|
| 111 |  | 
|---|
| 112 | <li><strong>genStringAsCharArray</strong> - Should text strings be generated as char | 
|---|
| 113 | arrays, to improve performance in some cases? Default <code>false</code>.</li> | 
|---|
| 114 |  | 
|---|
| 115 | <li><strong>ieClassId</strong> - The class-id value to be sent to Internet | 
|---|
| 116 | Explorer when using <jsp:plugin> tags.   Default | 
|---|
| 117 | <code>clsid:8AD9C840-044E-11D1-B3E9-00805F499D93</code>.</li> | 
|---|
| 118 |  | 
|---|
| 119 | <li><strong>javaEncoding</strong> - Java file encoding to use for generating | 
|---|
| 120 | java source files. Default <code>UTF8</code>.</li> | 
|---|
| 121 |  | 
|---|
| 122 | <li><strong>keepgenerated</strong> - Should we keep the generated Java source | 
|---|
| 123 | code for each page instead of deleting it? <code>true</code> or | 
|---|
| 124 | <code>false</code>, default <code>true</code>.</li> | 
|---|
| 125 |  | 
|---|
| 126 | <li><strong>mappedfile</strong> - Should we generate static content with one | 
|---|
| 127 | print statement per input line, to ease debugging? | 
|---|
| 128 | <code>true</code> or <code>false</code>, default <code>true</code>.</li> | 
|---|
| 129 |  | 
|---|
| 130 | <li><strong>modificationTestInterval</strong> - Causes a JSP (and its dependent | 
|---|
| 131 | files) to not be checked for modification during the specified time interval | 
|---|
| 132 | (in seconds) from the last time the JSP was checked for modification. A value of | 
|---|
| 133 | 0 will cause the JSP to be checked on every access. Used in development mode | 
|---|
| 134 | only. Default is <code>4</code> seconds.</li> | 
|---|
| 135 |  | 
|---|
| 136 | <li><strong>scratchdir</strong> - What scratch directory should we use when | 
|---|
| 137 | compiling JSP pages? Default is the work directory for the current web | 
|---|
| 138 | application.</li> | 
|---|
| 139 |  | 
|---|
| 140 | <li><strong>suppressSmap</strong> - Should the generation of SMAP info for JSR45 | 
|---|
| 141 | debugging be suppressed? <code>true</code> or <code>false</code>, default | 
|---|
| 142 | <code>false</code>.</li> | 
|---|
| 143 |  | 
|---|
| 144 | <li><strong>trimSpaces</strong> - Should white spaces in template text between | 
|---|
| 145 | actions or directives be trimmed ?, default <code>false</code>.</li> | 
|---|
| 146 |  | 
|---|
| 147 | <li><strong>xpoweredBy</strong> - Determines whether X-Powered-By response | 
|---|
| 148 | header is added by generated servlet. <code>true</code> or <code>false</code>, | 
|---|
| 149 | default <code>false</code>.</li> | 
|---|
| 150 | </ul> | 
|---|
| 151 | </p> | 
|---|
| 152 |  | 
|---|
| 153 | <p>The Java compiler from Eclipse JDT in included as the default compiler. It is | 
|---|
| 154 | an advanced Java compiler which will load all dependencies from the Tomcat class | 
|---|
| 155 | loader, which will help tremendously when compiling on large installations with | 
|---|
| 156 | tens of JARs. On fast servers, this will allow sub-second recompilation cycles | 
|---|
| 157 | for even large JSP  pages.</p> | 
|---|
| 158 |  | 
|---|
| 159 | <p>Apache Ant, which was used in previous Tomcat releases, can be used instead | 
|---|
| 160 | of the new compiler by simply removing the <code>lib/jasper-jdt.jar</code> file, | 
|---|
| 161 | and placing the <code>ant.jar</code> file from the latest Ant distribution in | 
|---|
| 162 | the <code>lib</code> folder.  If you do this, you also need to use the "javac" | 
|---|
| 163 | argument to catalina.sh.</p> | 
|---|
| 164 |  | 
|---|
| 165 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Production Configuration"><strong>Production Configuration</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 166 |  | 
|---|
| 167 | <p>The main JSP optimization which can be done is precompilation of JSPs. | 
|---|
| 168 | However, this might not be possible (for example, when using the | 
|---|
| 169 | jsp-property-group feature) or practical, in which case the configuration of the | 
|---|
| 170 | Jasper servlet becomes critical.</p> | 
|---|
| 171 |  | 
|---|
| 172 | <p>When using Jasper 2 in a production Tomcat server you should consider making | 
|---|
| 173 | the following changes from the default configuration. | 
|---|
| 174 | <ul> | 
|---|
| 175 | <li><strong>development</strong> - To disable on access checks for JSP | 
|---|
| 176 | pages compilation set this to <code>false</code>.</li> | 
|---|
| 177 | <li><strong>genStringAsCharArray</strong> - To generate slightly more efficient | 
|---|
| 178 | char arrays, set this to <code>true</code>.</li> | 
|---|
| 179 | <li><strong>modificationTestInterval</strong> - If development has to be set to | 
|---|
| 180 | <code>true</code> for any reason (such as dynamic generation of JSPs), setting | 
|---|
| 181 | this to a high value will improve performance a lot.</li> | 
|---|
| 182 | <li><strong>trimSpaces</strong> - To remove useless bytes from the response, | 
|---|
| 183 | set this to <code>true</code>.</li> | 
|---|
| 184 | </ul> | 
|---|
| 185 | </p> | 
|---|
| 186 |  | 
|---|
| 187 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Web Application Compilation"><strong>Web Application Compilation</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 188 |  | 
|---|
| 189 | <p>Using Ant is the preferred way to compile web applications using JSPC. | 
|---|
| 190 | Use the script given below (a similar script is included in the "deployer" | 
|---|
| 191 | download) to precompile a webapp: | 
|---|
| 192 | </p> | 
|---|
| 193 |  | 
|---|
| 194 | <p> | 
|---|
| 195 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> | 
|---|
| 196 | <project name="Webapp Precompilation" default="all" basedir="."> | 
|---|
| 197 |  | 
|---|
| 198 | <import file="${tomcat.home}/bin/catalina-tasks.xml"/> | 
|---|
| 199 |  | 
|---|
| 200 | <target name="jspc"> | 
|---|
| 201 |  | 
|---|
| 202 | <jasper | 
|---|
| 203 | validateXml="false" | 
|---|
| 204 | uriroot="${webapp.path}" | 
|---|
| 205 | webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml" | 
|---|
| 206 | outputDir="${webapp.path}/WEB-INF/src" /> | 
|---|
| 207 |  | 
|---|
| 208 | </target> | 
|---|
| 209 |  | 
|---|
| 210 | <target name="compile"> | 
|---|
| 211 |  | 
|---|
| 212 | <mkdir dir="${webapp.path}/WEB-INF/classes"/> | 
|---|
| 213 | <mkdir dir="${webapp.path}/WEB-INF/lib"/> | 
|---|
| 214 |  | 
|---|
| 215 | <javac destdir="${webapp.path}/WEB-INF/classes" | 
|---|
| 216 | optimize="off" | 
|---|
| 217 | debug="on" failonerror="false" | 
|---|
| 218 | srcdir="${webapp.path}/WEB-INF/src" | 
|---|
| 219 | excludes="**/*.smap"> | 
|---|
| 220 | <classpath> | 
|---|
| 221 | <pathelement location="${webapp.path}/WEB-INF/classes"/> | 
|---|
| 222 | <fileset dir="${webapp.path}/WEB-INF/lib"> | 
|---|
| 223 | <include name="*.jar"/> | 
|---|
| 224 | </fileset> | 
|---|
| 225 | <pathelement location="${tomcat.home}/lib"/> | 
|---|
| 226 | <fileset dir="${tomcat.home}/common/lib"> | 
|---|
| 227 | <include name="*.jar"/> | 
|---|
| 228 | </fileset> | 
|---|
| 229 | <fileset dir="${tomcat.home}/bin"> | 
|---|
| 230 | <include name="*.jar"/> | 
|---|
| 231 | </fileset> | 
|---|
| 232 | </classpath> | 
|---|
| 233 | <include name="**" /> | 
|---|
| 234 | <exclude name="tags/**" /> | 
|---|
| 235 | </javac> | 
|---|
| 236 |  | 
|---|
| 237 | </target> | 
|---|
| 238 |  | 
|---|
| 239 | <target name="all" depends="jspc,compile"> | 
|---|
| 240 | </target> | 
|---|
| 241 |  | 
|---|
| 242 | <target name="cleanup"> | 
|---|
| 243 | <delete> | 
|---|
| 244 | <fileset dir="${webapp.path}/WEB-INF/src"/> | 
|---|
| 245 | <fileset dir="${webapp.path}/WEB-INF/classes/org/apache/jsp"/> | 
|---|
| 246 | </delete> | 
|---|
| 247 | </target> | 
|---|
| 248 |  | 
|---|
| 249 | </project> | 
|---|
| 250 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div> | 
|---|
| 251 | </p> | 
|---|
| 252 |  | 
|---|
| 253 | <p> | 
|---|
| 254 | The following command line can be used to run the script | 
|---|
| 255 | (replacing the tokens with the Tomcat base path and the path to the webapp | 
|---|
| 256 | which should be precompiled):<br> | 
|---|
| 257 | <div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre> | 
|---|
| 258 | $ANT_HOME/bin/ant -Dtomcat.home=<$TOMCAT_HOME> -Dwebapp.path=<$WEBAPP_PATH> | 
|---|
| 259 | </pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div> | 
|---|
| 260 | </p> | 
|---|
| 261 |  | 
|---|
| 262 | <p> | 
|---|
| 263 | Then, the declarations and mappings for the servlets which were generated | 
|---|
| 264 | during the precompilation must be added to the web application deployment | 
|---|
| 265 | descriptor. Insert the <code>${webapp.path}/WEB-INF/generated_web.xml</code> | 
|---|
| 266 | at the right place inside the <code>${webapp.path}/WEB-INF/web.xml</code> file. | 
|---|
| 267 | Restart the web application (using the manager) and test it to verify it is | 
|---|
| 268 | running fine with precompiled servlets. An appropriate token placed in the | 
|---|
| 269 | web application deployment descriptor may also be used to automatically | 
|---|
| 270 | insert the generated servlet declarations and mappings using Ant filtering | 
|---|
| 271 | capabilities. This is actually how all the webapps distributed with Tomcat | 
|---|
| 272 | are automatically compiled as part of the build process. | 
|---|
| 273 | </p> | 
|---|
| 274 |  | 
|---|
| 275 | <p> | 
|---|
| 276 | At the jasper2 task you can use the option <code>addWebXmlMappings</code> for | 
|---|
| 277 | automatic merge the <code>${webapp.path}/WEB-INF/generated_web.xml</code> | 
|---|
| 278 | with the current web application deployment descriptor at | 
|---|
| 279 | <code>${webapp.path}/WEB-INF/web.xml</code>. When you want to use Java 5 | 
|---|
| 280 | features inside your jsp's, add the following javac compiler task attributes: | 
|---|
| 281 | <code>source="1.5" target="1.5"</code>. For live | 
|---|
| 282 | applications you can also compile with <code>optimize="on"</code> and | 
|---|
| 283 | without debug info <code>debug="off"</code>. | 
|---|
| 284 | </p> | 
|---|
| 285 |  | 
|---|
| 286 | <p> | 
|---|
| 287 | When you don't want to stop the jsp generation at first jsp syntax error, use | 
|---|
| 288 | <code>failOnError="false"</code>and with | 
|---|
| 289 | <code>showSuccess="true"</code> all successfull <i>jsp to java</i> | 
|---|
| 290 | generation are printed out. Sometimes it is very helpfull, when you cleanup the | 
|---|
| 291 | generate java source files at <code>${webapp.path}/WEB-INF/src</code> | 
|---|
| 292 | and the compile jsp servlet classes at | 
|---|
| 293 | <code>${webapp.path}/WEB-INF/classes/org/apache/jsp</code>. | 
|---|
| 294 | </p> | 
|---|
| 295 |  | 
|---|
| 296 | <p><strong>Hints:</strong> | 
|---|
| 297 | <ul> | 
|---|
| 298 | <li> When you switch to another Tomcat release, then regenerate and recompile | 
|---|
| 299 | your jsp's with the new Tomcat version.</li> | 
|---|
| 300 | <li>Use java system property at server runtime to disable tag pooling | 
|---|
| 301 | <code>org.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false</code>. | 
|---|
| 302 | and limit the buffering with | 
|---|
| 303 | <code>org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true</code>. Note | 
|---|
| 304 | that changing from the defaults may affect performance, but it will vary | 
|---|
| 305 | depending on the application.</li> | 
|---|
| 306 | </ul> | 
|---|
| 307 | </p> | 
|---|
| 308 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Using Jikes"><strong>Using Jikes</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 309 |  | 
|---|
| 310 | <p>If you wish to use | 
|---|
| 311 | <a href="http://oss.software.ibm.com/developerworks/opensource/jikes/"> | 
|---|
| 312 | Jikes</a> to compile JSP pages: | 
|---|
| 313 | <ul> | 
|---|
| 314 | <li>From your <a href="ant.apache.org">Ant</a> installation, copy ant.jar | 
|---|
| 315 | and (if it's available: Ant 1.5 and later) ant-launcher.jar to | 
|---|
| 316 | <code>$CATALINA_HOME/lib</code>.</li> | 
|---|
| 317 | <li>Download and install jikes. jikes must support the -encoding option. | 
|---|
| 318 | Execute <code>jikes -help</code> to verify that it was built with support | 
|---|
| 319 | for <code>-encoding</code>.</li> | 
|---|
| 320 | <li>Set the init parameter <code>compiler</code> to <code>jikes</code>.</li> | 
|---|
| 321 | <li>Define the property <code>-Dbuild.compiler.emacs=true</code> when starting | 
|---|
| 322 | Tomcat by adding it to your <code>CATALINA_OPTS</code> environment variable. | 
|---|
| 323 | This changes how jikes outputs error messages so that it is compatible with | 
|---|
| 324 | Jasper.</li> | 
|---|
| 325 | <li>If you get an error reporting that jikes can't use UTF8 encoding, try | 
|---|
| 326 | setting the init parameter <code>javaEncoding</code> to | 
|---|
| 327 | <code>ISO-8859-1</code>.</li> | 
|---|
| 328 | </ul> | 
|---|
| 329 | </p> | 
|---|
| 330 |  | 
|---|
| 331 | </blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em> | 
|---|
| 332 | Copyright © 1999-2008, Apache Software Foundation | 
|---|
| 333 | </em></font></div></td></tr></table></body></html> | 
|---|