Compiling JSPs

When you create a JSP using EAServer Manager, the load during startup option determines if your JSPs are compiled at server start-up or when the JSP is first called. You can also use a command-line utility to compile your JSPs manually. This allows you to debug and test your JSPs without running the server. This section describes the JSP compiler supplied with your EAServer installation.

jspc compiler

The %JAGUAR%\bin\jspc.bat (Windows) and $JAGUAR/bin/jspc.sh (UNIX) compiler provides you with several options for compiling your JSPs. This section uses jspc.sh for demonstration purposes. All options are valid for both systems.

You can also compile JSPs with the jagtool or jagant compilejsp command. For details, see Chapter 12, “Using jagtool and jagant,” in the EAServer System Administration Guide.

Usage

                    jspc.sh <options> <jsp files>|<jsp dirs> 

options include:

jsp files include any number of:

Examples

This section provides examples of the various jspc compiler options:

jspc.sh -webapp MyWebApp /pets/cat.jsp /pets/dog.jsp

The compiler identifies the $JAGUAR/Repository/WebApplication/MyWebApp directory as the Web application directory and compiles the cat.jsp and dog.jsp files located in the $JAGUAR/Repository/WebApplication/MyWebApp/pets directory.

jspc.sh -uriroot $JAGUAR/Repository/WebApplicaton/MyWebApp -d $JAGUAR/work /pets/cat.jsp /pets/dog.jsp

The compiler identifies the $JAGUAR/Repository/WebApplication/MyWebApp directory as the Web application directory and compiles the cat.jsp and dog.jsp files, which are located in the pets subdirectory, and outputs the results to the $JAGUAR/work directory.

jspc.sh -uriroot $JAGUAR/Repository/WebApplicaton/MyWebApp -d $JAGUAR/work -jspdir $JAGUAR/Repository/WebApplicaton/MyWebApp

The compiler identifies the $JAGUAR/Repository/WebApplication/MyWebApp directory as the Web application directory and compiles all JSP files contained in it and any subdirectories, and outputs the results to the $JAGUAR/work directory.

jspc.sh -uriroot $JAGUAR/Repository/WebApplicaton/MyWebApp -d $JAGUAR/work -keep /pets/dog.jsp /pets/cat.jsp

the -keep option notifies the compiler to keep all generated Java files in the output directory, along with the compiled JSP files.