uCosminexus Application Server, Web Container Functionality Guide
(1) Overview of commands
This subsection explains the preconditions for implementing the JSP pre-compilation, the files required during execution of the JSP pre-compilation and the files generated after executing JSP pre-compilation:
- Preconditions
- To implement JSP pre-compilation, it is assumed that the JSP files to be compiled are stored under the Web application root directory or under the sub directory.
- Files required for JSP pre-compilation
- The following files are required for implementing JSP pre-compilation:
- JSP files (JSP 1.1, JSP 1.2, JSP 2.0, or JSP 2.1)#1
- Tag files compliant with JSP 2.0 specifications or JSP 2.1 specifications
- Files that are statically included from the JSP files and the tag files
- TLD file#2
- web.xml#2#3
- Class library necessary for compilation
- #1 JSP files implies the following files:
- Files with .jsp or .jspx extension (.jspx is only in the case of JSP 2.0 or later)
- Files specified in <jsp-file> tag of web.xml
- Files matching with <jsp-property-group><url-pattern> tag of web.xml (only in the case of JSP 2.0 or later)
- #2 Whether the tag files conform to the DTD or XML schema during execution of JSP pre-compilation is verified.
- #3 If web.xml does not exist, the compilation is executed assuming the Web application version to be version 3.0.
- Files generated after JSP pre-compilation JSP compilation results)
- The Java source files and the class files generated from the JSP files and the tag files are called JSP compilation results. When you implement JSP pre-compilation, the following JSP compilation results are generated in the JSP working directory.
- The Java source files and class files generated from the JSP files
- The Java source files and class files generated from the tag files
- Note that during the execution of the JSP pre-compilation, you can specify whether to save the Java source files.
The cjjspc command is used to implement JSP pre-compilation. If you implement this command during development of an application, you can compile the JSP files contained in a Web application. JSP pre-compilation with the cjjspc command includes the following two methods:
- Pre-compilation in each JSP file
This method compiles only the specified JSP files among the JSP files included in a Web application.
- Pre-compilation in each Web application
This method compiles all the JSP files included in each Web application.
You can specify the following contents during execution of the cjjspc command:
- Specifying the JSP files that need not be compiled
You can exclude the pre-compilation of JSP files that need not be compiled by specifying them beforehand. The specification methods are as follows: Specify the JSP file names that need not be compiled one-by-one in the command. Mention all the JSP file names that need not be compiled together in a file and then specify that file in the command.
- Specifying whether to output the list file of execution results
You can specify whether to output the list file of execution results. The list file of execution results refers to the file in which the execution results of the cjjspc command are output. The paths of the JSP files that are compiled successfully, the JSP files that were not be compiled, and the JSP files that are excluded from compilation are output in a list.
- Specifying whether to save the Java source files
You can specify whether to save the Java source files generated from the JSP.
- Specifying the version of Java language specification during JSP compilation
You can specify the version of Java language specification during compilation of the Java source file generated by JSP translation.
- Specifying whether to change the name of the JSP working directory
The JSP working directory refers to the directory that saves the JSP compilation results. You can change the name of the JSP working directory. For details on the JSP working directory, see 2.5.5(2) Output destination of JSP compilation results.
- Specifying the default character encoding
You can specify the default character encoding for the JSP file. For an overview of the default character encoding, see 2.6 Functionality for setting up the default character encoding. Also, for details on the precautions when you set up the default character encoding with the version 07-10 for the Web applications that use the JSP pre-compilation functionality with the version 07-00, see 2.6.8(5) Specifying the character encoding for Web applications that executed JSP pre-compilation with version 07-00.
- Specifying whether to use the JSP debug functionality
You can specify whether you want to use the JSP debug functionality. For details on the JSP debug functionality, see 2.4 JSP debug functionality.
- Specifying the classes to be imported implicitly
You can specify the class name to be imported implicitly by using the functionality for implicitly importing the import attribute of the page/tag directive. For details on the functionality for implicitly importing the import attribute of the page/tag directive, see 2.3.7 Implicitly importing the import attribute of the page/tag directive.
Note that these settings are specified with command options. For details on the usage of the JSP pre-compilation command (cjjspc command), see cjjspc (JSP pre-compilation) in the uCosminexus Application Server Command Reference Guide.
- Note
- Changing the JavaVM runtime options
- If you set the environment variable CJ_CMD_JVM_ARGS, you can change the JavaVM runtime options operated by the cjjspc command.
- By default, -Xmx512m (maximum value of Java heap memory area is 512 MB) is specified in the JavaVM runtime option. When you want to compile large-scale Web applications using the cjjspc command, the maximum value of the Java heap memory area might exceed and java.lang.OutOfMemoryError might occur. Therefore, when compiling large-scale Web applications, you must specify the appropriate Java heap memory area in the environment variable CJ_CMD_JVM_ARGS in advance.
- Reference note
- When performing the JSP pre-compilation with the cjjspc command, if an error occurs during translation of the JSP files or the tag files, error messages are output. An error message is output to the console.
- When the command is executed, the log is output in the standard output or standard error output. To keep the result of log output in a file, redirect the command output to a file.
The following are the specification examples for keeping the results of log output in a file:
In Windows
> cjjspc -root D: \app\webapp1 1> .\stdout.log 2> .\stderr.log
|
In UNIX
# cjjspc -root /app/webapp1 1> ./stdout.log 2> ./stderr.log
|
The cjstartapp command is used to start a J2EE application. In the cjstartapp command, if you specify the option that performs the JSP pre-compilation, the J2EE application is started after the JSP pre-compilation is implemented. The JSP pre-compilation functionality at the time of starting the J2EE application compiles all the JSP files contained in the J2EE application.
You can specify the settings for operation during execution of the cjstartapp command in advance. The following contents can be specified:
- Specifying whether to save the Java source files
You can specify whether to save the Java source files generated from the JSP file.
- Specifying the version of Java language specification during JSP compilation
You can specify the version of Java language specification during compilation of the Java source file generated by JSP translation.
- Specifying whether to change the name of the JSP working directory
The JSP working directory refers to the directory that saves the JSP compilation results. You can change the name of the JSP working directory. For details on the JSP working directory, see 2.5.5(2) Output destination of JSP compilation results.
- Specifying the classes to be imported implicitly
You can specify the class name to be imported implicitly by using the functionality for implicitly importing the import attribute of the page/tag directive. For details on the functionality for implicitly importing the import attribute of the page/tag directive, see 2.3.7 Implicitly importing the import attribute of the page/tag directive.
Note that you customize the operation settings of the J2EE server to implement these settings. For details on the customization of the operation settings of the J2EE server, see 2.5.8 Execution environment settings (J2EE server settings).
- Reference note
- When performing the JSP pre-compilation by the cjstartapp command, if an error occurs during translation of the JSP files or tag files, an error message is output to the Web servlet log or the message log.
- Note
- Compilation of Java source generated from JSP
- The class file generated using with the cjjspc command is used at runtime on the J2EE server. In the cjjspc command, a class file same as that of the file generated on the J2EE server will be generated.
- Therefore, when compiling Java source that is generated from the JSP file or tag file, you can only specify the version of the Java language specification in the -source option or the class path in the classpath option. For details on how to specify the versions of the Java language specifications, see cjjspc (JSP pre-compilation) in the uCosminexus Application Server Command Reference Guide.
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.