+

Search Tips   |   Advanced Search

JSPBatchCompiler command

The batch compiler validates the syntax of JSP, 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 the JSP files and thereby enable faster responses to the initial client requests for the JSP files on the production web server.

The batch compiler can be executed against compressed or expanded EAR files and WAR files, as well as enterprise applications and web modules that have been deployed into WebSphere Application Server. When the target is a deployed enterprise application, the server does not need to be running to execute the batch compiler. If the batch compiler is executed while the target sever is running, the server is not aware of an updated class file and does not load that class file unless the enterprise application is restarted. When the target is a compressed EAR file or WAR file, the batch compiler must expand it before executing.


Processing of web modules

The batch compiler operates on one web module at a time. If the target is either an EAR file or an installed enterprise application containing more than one web module, the batch compiler operates on each web module individually. This is done because JSP pages are configured on a web module basis, through the web module's web.xml deployment descriptor file. Within a web module, the batch compiler processes one directory at a time. It validates and translates each JSP page individually, and then invokes the Java compiler for the entire group of generated Java sources files in that directory. If one JSP page fails during the Java compilation phase, the Java compiler might not create class files for most or all of the JSP pages that successfully compiled in that directory.


JSP file extensions

The batch compiler uses four things to determine what file extensions it should process:

  1. Standard JSP file extensions

    • *.jsp

    • *.jspx

    • *.jsw

    • *.jsv

  2. The url-pattern property of the jsp-property-group elements in the deployment descriptor file in Servlet 2.4 web modules

  3. The jsp.file.extensions JSP engine configuration parameter (for pre-Servlet 2.4 web modules)

  4. The batch compiler configuration parameter jsp.file.extensions

The standard extensions are always used by the batch compiler. If the web module contains a Servlet 2.4 deployment descriptor, the batch compiler also processes any url-patterns found within the jsp-config element. If the batch compiler target contains the JSP engine configuration parameter jsp.file.extensions, then those extensions are also processed. If the batch compiler configuration parameter jsp.file.extensions is present, the extensions given are also processed and will override the JSP engine configuration parameter jsp.file.extensions.

It is a good idea to give JSP 'fragments' an extension that is not processed by the batch compiler. Statically-included fragments that do not stand alone generate translation or compilation errors if processed. The JSP 2.0 Specification suggests that you use the extension .jspf for such files.


Batch compiler command

Both a Windows batch file, JspBatchCompiler.bat and UNIX shell script JspBatchCompiler.sh for running the batch compiler from the command line are found in the {WAS_ROOT}/bin directory. An Ant task is also available for executing the batch compiler using Ant. See the topic, Batch Compiler Ant Task for additional information.

The JspBatchCompiler script for running the batch compiler from the Qshell command line is found in the app_server_root/bin directory. An Ant task is also available for executing the batch compiler using Ant. See the topic, Batch Compiler Ant Task for additional information.

The batch compiler target is the only required parameter. The target is one of -ear.path, -war.path or -enterpriseapp.name.

JspBatchCompiler -ear.path | -war.path | -enterpriseapp.name <name>
   [-response.file <filename>]
   [-webmodule.name <name>]
   [-filename <jsp name | directory name>
   [-recurse <true | false>]
   [-config.root <path>]
   [-cell.name <name>]
   [-cluster.name <name>]   [-node.name <name>]
   [-server.name <name>]
   [-profileName <name>]
   [-extractToDir <path>]
   [-compileToDir <path>]
   [-compileToWebInf <true | false>]
      [-compileToWebInf <true | false>]
      [-compileAfterFailure <true | false>]
   [-translate <true | false>]
   [-compile <true | false>]
   [-removeTempDir <true | false>]
   [-forceCompilation <true | false>]
   [-useFullPackageNames <true | false>]
   [-trackDependencies <true | false>]
   [-createDebugClassfiles <true | false>]
   [-keepgenerated <true | false>]
   [-keepGeneratedclassfiles <true | false>]
   [-usePageTagPool <true | false>]
   [-useThreadTagPool <true | false>]
   [-classloader.parentFirst <true | false>]
   [-classloader.singleWarClassloader <true | false>]
   [-additional.classpath <classpath to additional JAR files and classes>]
         [-verbose <true | false>]
   [-deprecation <true | false>]
   [-javaEncoding <encoding>
   [-jdkSourceLevel <13 | 14 | 15 | 16 | 17>]       [-compilerOptions <space-separated list of java compiler options>]
   [-useJikes <true | false>]
   [-jsp.file.extensions <file extensions to process>]
   [-log.level <SEVERE | WARNING | INFO | CONFIG | FINE | FINER | FINEST | OFF>]

   *** See batchcompiler.properties.default in WAS_ROOT/bin for more information. ***
   *** See JspCBuild.xml in WAS_ROOT/bin for information about the public WebSphere Ant task JspC. ***

   *** See batchcompiler.properties.default in app_server_root/bin for more information. ***
   *** See JspCBuild.xml in app_server_root/bin for information about the public WebSphere Ant task JspC. ***

The batch compiler is aware of three groups of configuration parameters:

  1. JSP engine configuration parameters for a web module.

    Refer to the JSP engine configuration parameters topic.

  2. Batch compiler response file configuration parameters.

    These are the parameters found in a batch compiler response file. See -response.file.

  3. Batch compiler command line configuration parameters.

    These are the parameters entered on the command line when running the batch compiler.

The batch compiler looks at all three groups of configuration parameters in order to determine which value for a parameter is used when compiling JSP pages. When resolving the value for a given parameter, the precedence is:

  1. If the parameter is found on the command line, its value is used.

  2. If the parameter is not found on the command line, the batch compiler looks for the parameter in a response file named on the command line.

  3. If no response file is named, or if the parameter is not found therein, the batch compiler looks for the parameter in the web module's JSP engine configuration parameters.

If a configuration parameter is not found among these three groups, then a default value is used. The default values for the configuration parameters are given along with the description of the parameters.

With one exception, these parameters are not case sensitive; -profileName is case sensitive. If the values specified for these arguments are comprised of two or more words separated by spaces, add quotation marks around the values.

The batch compiler does not create, or set the values of, equivalent JSP engine parameters. This means that if a JSP page in a deployed Web module is modified and is recompiled by the JSP engine at run time, the JSP engine's configuration parameters will determine the engine's behavior. For example, if you use the batch compiler to compile a web module and you use the -useFullPackageNames true option, the JSP files will be compiled to support that option. But the JSP engine parameter useFullPackageNames must also be set to true in order for the JSP runtime to be able to load the compiled JSP pages. If JSP pages are modified in a deployed web module, then the engine's parameters should be set to the same values used in batch compilation.

To use the JSP batch compiler, enter one of the following commands on a single line at an operating system command prompt.:


Related concepts

  • JSP


    Related tasks

  • Configure JSP engine parameters

  • Batch compiler ant task
  • Web applications: Resources for learning


    Related information:

  • JSP engine configuration parameters Reference topic