JSP batch compilation
As an IBM enhancement to JavaServer Pages (JSP) support, WebSphere Application Server provides a batch JSP compiler that allows JSP compilation before application deployment. The batch compiler validates the syntax of JSP pages, translates the JSP pages into Java source files, and compiles the Java source files into Java servlet class files. The batch compiler also validates tag files and generates their Java implementation classes.
Batch compilation of JSP pages in a predeployed application simplifies the deployment process and improves the runtime performance by eliminating first-request compilations. The batch compiler also operates on enterprise applications deployed into WAS.
The JSP batch compiler works on web modules that support Servlet 2.2 and later. The batch compiler works on JSP pages written to the JSP 2.3 specification or previous specifications back to JSP 1.0. It recognizes a Servlet 2.5 or later deployment descriptor, web.xml, and can use any jsp-config elements that it may contain. In a Servlet 2.3 (JSP 1.2) or Servlet 2.2 (JSP 1.1) deployment descriptor the batch compiler recognizes and uses any tag library elements that the descriptor may contain.
Batch compiling makes the first request for a JSP page much faster because the JSP page is already translated and compiled into a servlet. Batch compiling is also useful as a fast way to resynchronize all of the JSP pages for an application.
The batch compiler supports the generation of class files in both the WAS temp directory and a web module's WEB-INF/classes directory, depending on the type of batch compiler target. In addition, the batch compiler enables generation of class files into any directory on the file system, outside the target application. Generating class files into a web module's WEB-INF/classes directory enables the web module to be deployed as a self-contained WAR file, or a WAR inside an EAR.
Also, we can use shared libraries with the JSP batch complier. When we use the JSP batch compiler, we must either add the JAR to the WAR in the <WEB-INF>/lib directory, or add the JAR to the JVM class path to use shared libraries.
(iSeries) Use the pre-touch tool for batch compilation, which can compile and load JSP class files into the application server JVM. This tool offers improved performance over the JSP batch compiler on iSeries servers. Refer to the Pre-touch tool for compiling and loading JSP files article for more information.
Subtopics
- JSPBatchCompiler command
The batch compiler validates the syntax of JavaServer Pages, translates the JSP pages into Java source files, and compiles the Java source files into Java Servlet class files. The batch compiler also validates tag files and generates their Java implementation classes. Use this function to batch compile your JSP files and enable faster responses to the initial client requests for the JSP files on the production web server.- Batch compiler ant task
The ant task JspC exposes all the batch compiler configuration options. It runs the batch compiler under the covers. It is backward compatible with the WAS 5.x version of the JspC ant task. The following table lists all of the ant task attributes and their batch compiler equivalents.- Pre-touch tool for compiling and loading JSP files
When enabled, the pre-touch mechanism causes all JavaServer Pages (JSP) files to be compiled within the web module for which they are configured. We can also configure some or all JSP files to be class loaded and JIT-compiled.
- Batch compiler class path
The batch compiler builds its class path as shown in the table later in this topic. When the batch compiler target is a web application archive (WAR) file and war.path is supplied, the configuration additional.classpath parameter is used to give extra class path information.
Related:
JSP class file generation Packages and directories for generated .java and .class files Global tag libraries (deprecated) JavaServer Pages Web container configuration for JavaServer Pages static file access Web applications: Resources for learning