Note: The feature to help reduce JSP compile times is only available in WebSphere Application Server - Express V5.0.2.3. See WebSphere PTF Information (http://www.ibm.com/servers/eserver/iseries/software/websphere/wsappserver/services/service.htm) for more information on available PTFs.
When WebSphere Application Server compiles a JSP, it creates a large classpath that includes every WebSphere Application Server .jar file to ensure that any class referenced by a given JSP is found. The greater the number of .jar files and classes on the classpath, the longer it takes for a JSP to compile.
However, most JSPs only invoke a few WebSphere Application Server APIs, which makes the large classpath unnecessary. In WebSphere Application Server - Express for iSeries, there is a new feature that helps reduce JSP compile times. You can now edit the classpath that is used for compiling JSPs in your application.
Note: This feature only controls the classpath for compiling your JSP. The environment used to load and run your JSP remains unchanged.
The feature to reduce compile times is controlled by a JSP initialization parameter. This gives you control over the JSP compile classpath on each web module.
Name:
jsp.compile.classpath
Value:
A space-separated list of paths. If a path contains a space, put quotation marks around the path. Paths that are not fully
qualified are resolved to the web module directory during run time.
Configuration
There are several ways to configure the jsp.compile.classpath feature:
To configure the jsp.compile.classpath feature using the WebSphere Development Studio Client for iSeries (recommended), perform the following steps:
JSP Processor in webapp [Default Web Application] Using compile classpath [/QIBM/ProdData/WebASE5/ASE/lib/webcontainer.jar:/QIBM/ProdData/WebASE5/ ASE/lib/j2ee.jar:/QIBM/UserData/WebASE5/ASE/myInstance/installedApps/server/ DefaultApplication.ear/DefaultWebApplication.war/WEB-INF/classes:]
Note: This message is given because the jsp.compile.classpath is set to an empty-string value.
To configure the jsp.compile.classpath feature on an installed application using a text editor, perform the following steps:
name="jsp.compile.classpath" value="classpath"where classpath is the value of the desired classpath. See Determine the classpath to use for more information on setting the correct classpath. For example, your file should look like the following:
<?xml version="1.0" encoding="UTF-8"?> . . . <jspAttributes xmi:id="JSPAttribute_1" name="jsp.compile.classpath" value=""/> </webappext:WebAppExtension>
JSP Processor in webapp [Default Web Application] Using compile classpath [/QIBM/ProdData/WebASE5/ASE/lib/webcontainer.jar:/QIBM/ProdData/WebASE5/ ASE/lib/j2ee.jar:/QIBM/UserData/WebASE5/ASE/myInstance/installedApps/server/ DefaultApplication.ear/DefaultWebApplication.war/WEB-INF/classes:]
Note: This message is given because the jsp.compile.classpath is set to an empty-string value.
Determine the classpath to use:
Determining the classpath for compiling a JSP is similar to determining a classpath for a servlet or other type of Java file. Look at the classes that are referenced in the JSP source, and make sure that the class or the .jar file where the class is found is on the specified classpath. However, you must give special consideration to JSPs that use custom tags, because custom tags contain references to classes.
JSPs always require the webcontainer.jar and j2ee.jar files. JSPs are also likely to reference classes in a web application for custom tags and other application-specific criteria. For these reasons, the following paths are automatically prepended to the paths you specify for jsp.compile.classpath when your application is started:
It is likely that the above files are sufficient for your JSPs to compile, in which case you only need to specify an empty string for the jsp.compile.classpath value.
You can use WebSphere Application Server variables for your classpath entries. For example, if you reference a WebSphere Application Server .jar file, such as /QIBM/ProdData/WebASE5/ASE/lib/admin.jar, you can use the WAS_LIBS_DIR variable, which changes your classpath entry to ${WAS_LIBS_DIR}/admin.jar
Example: Determine classpath and configure jsp.compile.classpath
The following JSP references com.ibm.websphere.cache.CacheEntry, com.mycompany.somepackage.MyClass, and com.mycompany.earlevel.EarClass:
<% com.ibm.websphere.cache.CacheEntry entry = null; %> <% com.mycompany.somepackage.MyClass object = null; %> <% com.mycompany.earlevel.EarClass object2 = null; %>
Three classes are referenced:
The file mywebjar.jar is automatically added to the classpath because it exists in the WEB-INF/lib directory. However, dynacache.jar and myearjar.jar must be explicitly added to the classpath. The JSP initialization parameters are now as follows:
Name:
jsp.compile.classpathValue:
${WAS_LIBS_DIR}/dynacache.jar ${APP_INSTALL_ROOT}/node_name/MyEnterpriseApplication.ear/myearjar.jar (where node_name is the name of your application server node, MyEnterpriseApplication.ear is the name of your enterprise application, and myejbjar.jar is the name of your Java archive file).Note: The space separator is used between paths (not a colon).