uCosminexus Application Server, Web Container Functionality Guide
This subsection explains the checks implemented during execution of JSP pre-compilation functionality and the operation of a J2EE application in which the JSP pre-compilation functionality is executed.
When the JSP pre-compilation is executed, validity check of web.xml and version check of the JSP compilation results are implemented.
With the JSP pre-compilation functionality, whether the web.xml conforms to the DTD or XML schema is verified before execution of compilation processing. Moreover, the validity of settings for the elements referenced during JSP pre-compilation is also verified to the extent necessary for JSP pre-compilation. If the elements do not conform to the schema, an error occurs during the translation of JSP that generates a Java file from the JSP file.
The following table describes the elements of web.xml verified during execution of JSP pre-compile.
Table 2-11 Elements of web.xml verified during execution of JSP pre-compilation
Tag names | Tag description | Servlet version | |||||||
---|---|---|---|---|---|---|---|---|---|
2.2 | 2.3 | 2.4 | 2.5 | 3.0 | |||||
<!DOCTYPE> | DOCTYPE declaration | Y | Y | N | N | N | |||
<web-app> | Root tag | Y | Y | Y | Y | Y | |||
<servlet> | Definitions about the servlet | Y | Y | Y | Y | Y | |||
<jsp-file> | JSP file name | Y | Y | Y | Y | Y | |||
<taglib> | Definitions about the tag library | Y | Y | -- | -- | -- | |||
<taglib-uri> | URI of tag library | Y | Y | -- | -- | -- | |||
<taglib-location> | Location of tag library descriptor file (TLD) | Y | Y | -- | -- | -- | |||
<jsp-config> | Definitions about the JSP | -- | -- | Y | Y | Y | |||
<taglib> | Definitions about the tag library | -- | -- | Y | Y | Y | |||
<taglib-uri> | URI of tag library | -- | -- | Y | Y | Y | |||
<taglib-location> | Location of tag library descriptor file (TLD) | -- | -- | Y | Y | Y | |||
<jsp-property-group> | Settings of JSP that matches with the specified URL pattern | -- | -- | Y | Y | Y | |||
<url-pattern> | URL pattern of JSP for which installation is applied | -- | -- | Y | Y | Y | |||
<el-ignored> | Settings indicating whether to ignore EL (Expression Language) | -- | -- | Y | Y | Y | |||
<scripting-invalid> | Settings indicating whether to disable the scripting element | -- | -- | Y | Y | Y | |||
<page-encoding> | Page encoding name | -- | -- | Y | Y | Y | |||
<include-prelude> | File included as the JSP header | -- | -- | Y | Y | Y | |||
<include-coda> | File included as the JSP footer | -- | -- | Y | Y | Y | |||
<is-xml> | Settings indicating whether coding is done in XML format | -- | -- | Y | Y | Y | |||
<deferred-syntax-allowed-as-literal> | Settings indicating whether the presence of #{ string in the part where EL is not used is to be considered as an error | -- | -- | -- | Y | Y | |||
<trim-directive-whitespaces> | Settings indicating whether to output extra spaces from JSP | -- | -- | -- | Y | Y |
When using the JSP pre-compilation functionality, check if the version of the Web application specified in web.xml for the J2EE server matches with the version of JSP during JSP compilation. The version check is implemented in the following cases:
The class files generated from JSP depend on the version of the Web application specified in web.xml. You cannot use the class files in a Web application whose version is different from the version of the Web application during execution of JSP pre-compilation. Consequently, if the version of a Web application is changed, you need to compile all the JSP files.
Note that in the following cases, since all JSP files included in a Web application are compiled, the JSP compilation result is not checked.
You validate whether the TLD file complies with DTD or XML schema during the JSP pre-compilation. The following is the description for TLD file check related to each version of Web applications:
This subsection explains the operation of a J2EE application in which the JSP pre-compilation functionality is executed.
When JSP pre-compilation is being implemented, JSP compilation is not implemented during execution of a request. The class files of JSP created during pre-compilation are loaded and executed.
In such a case, an error occurs if the class files compiled from the JSP files do not exist. The following table describes the behavior of the J2EE server when JSP pre-compilation is implemented and the files do not exist:
Table 2-12 Behavior of the J2EE server when the files do not exist (when JSP pre-compilation is executed)
Non-existent files | Behavior of the J2EE server | |
---|---|---|
JSP files | JSP files | JSP file is not referenced |
Class file | Error 404 is returned | |
Tag files | Tag files | Tag file is not referenced |
Class file | Error 500 is returned (java.lang.NoClassDefFoundError occurs) | |
Statically included file | Statically included file is not referenced | |
TLD file | TLD file is not referenced |
The J2EE server operates as follows, when the pre-compilation is not implemented and the files do not exist:
Table 2-13 Behavior of the J2EE server when the files do not exist (when JSP pre-compilation is not executed)
Non-existent files | Behavior of the J2EE server | |
---|---|---|
JSP files | JSP files | Error 404 is returned |
Class file | JSP files are compiled | |
Tag files | Tag files | Error 500 is returned (compilation error) |
Class file | Tag files are compiled | |
Statically included file | Error 500 is returned (compilation error) | |
TLD file |
If you pre-compile the JSP files of a Web application in which <load-on-startup> is specified in the JSP files with web.xml, JSP compilation is not implemented when a J2EE application is started. The class files generated during JSP pre-compilation are loaded and jspInit method is executed. In such a case, loading of JSP files fails, if the class files of JSP, or a class file on which JSP depends does not exist.
Note that if the settings for error notification in servlet and JSP are enabled, the operation fails when starting a Web application. For details on the settings for error notification in servlets and JSPs, see 9.16 Settings for error notification in servlets and JSPs in the uCosminexus Application Server Application Setup Guide.
The notes related to the JSP pre-compilation functionality are as follows:
All Rights Reserved. Copyright (C) 2013, Hitachi, Ltd.