Precompiles JSP source code into Enterprise Server compatible Java code for initial invocation by Enterprise Server. Use this task to speed up access to JSP files or to check the syntax of JSP source code. You can feed the resulting Java code to the javac task to generate class files for the JSP files.
The following table describes attributes for the sun-appserv-jspc task.
Table 3–11 The sun-appserv-jspc Attributes
Attribute |
Default |
Description |
---|---|---|
none |
The destination directory for the generated Java source files. |
|
none |
(exactly one of these is required: srcdir or webapp) The source directory where the JSP files are located. |
|
none |
(exactly one of these is required: srcdir or webapp) The directory containing the web application. All JSP files within the directory are recursively parsed. The base directory must have a WEB-INF subdirectory beneath it. When webapp is used, sun-appserv-jspc hands off all dependency checking to the compiler. |
|
2 |
(optional) The verbosity integer to be passed to the compiler. |
|
none |
(optional) The classpath for running the JSP compiler. |
|
none |
(optional) A reference to the JSP compiler classpath. |
|
/ |
(optional) The URI context of relative URI references in the JSP files. If this context does not exist, it is derived from the location of the JSP file relative to the declared or derived value of uriroot. Only pages translated from an explicitly declared JSP file are affected. |
|
see description |
(optional) The root directory of the web application, against which URI files are resolved. If this directory is not specified, the first JSP file is used to derive it: each parent directory of the first JSP file is searched for a WEB-INF directory, and the directory closest to the JSP file that has one is used. If no WEB-INF directory is found, the directory from which sun-appserv-jspc was called is used. Only pages translated from an explicitly declared JSP file (including tag libraries) are affected. |
|
none |
(optional) The destination package for the generated Java classes. |
|
see description |
(optional) The installation directory for the local Enterprise Server installation, which is used to find the administrative classes. If not specified, the command checks if the asinstalldir parameter has been set. Otherwise, administrative classes must be in the system classpath. |
The following example uses the webapp attribute to generate Java source files from JSP files. The sun-appserv-jspc task is immediately followed by a javac task, which compiles the generated Java files into class files. The classpath value in the javac task must be all on one line with no spaces.
<sun-appserv-jspc destdir="${assemble.war}/generated" webapp="${assemble.war}" classpath="${assemble.war}/WEB-INF/classes" asinstalldir="${asinstalldir}" /> <javac srcdir="${assemble.war}/WEB-INF/generated" destdir="${assemble.war}/WEB-INF/generated" debug="on" classpath="${assemble.war}/WEB-INF/classes:${asinstalldir}/lib/ appserv-rt.jar:${asinstalldir}/lib/appserv-ext.jar"> <include name="**/*.java"/> </javac>