Portlet Factory, Version 6.1.2


 

Pre-compiling model JSPs

Pre-generating and pre-compiling Java Server Pages (JSPs) prior to deployment eliminates the delay a user experiences due to the lag time caused by waiting for JSP pages to generate and compile. The JSP Pre-Compile tool provides a way for developers and deployment engineers to compile JSPs ahead of time. You pre-compile JSPs from the command line. This process requires you to execute a compile command with one or more arguments. A script-based version of the JSP Pre-Compile tool is available as a Windows batch command and also as a UNIX script. The tool can accept several optional arguments that allow you to control how JSP generation and compilation is performed.

Compile scripts take the following arguments:

-url

(required) This is the base URL for static files (HTML or JSP, for example) on the server. This argument must include the application context. Typical syntax for this argument might looks as follows: -url http://serverName:port/appContext/

-modellist

(optional) Name of a file that lists the model IDs of the models you want examined. This file lists one ID per line and it can be created in any text editor. For example: factory/samples/tutorialFinished. If this argument is not supplied, all models are examined and associated JSPs compiled. Use this argument when you want to work with a subset of models in an application. Typical syntax for this argument looks as follows: -modellist listOfModels.txt

-profilelist

(optional) Name of a file that lists the profiles you want examined. This file lists one profile and profile set per line (for example, profile setBAR!profileFOO) and the file can be created in any text editor.

You can use this argument to limit the number of model/profile combinations that the pre-compile tool examines and generates This argument directs the tool to use only the specified profiles. (In addition, the default profile set is always used.) If this argument is not supplied, all model/profile combinations are examined and associated JSPs compiled. Typical syntax for this argument looks as follows: -profilelist listOfProfiles.txt

A complete pre-compile command might look as follows: compileJSP -url http://<serverName>:<port>/<appContext>/ -modellist listOfModels.txt -profilelist listOfProfiles.txt

Note: Disable JSP Security Required. WebSphere Portlet Factory creates all JSP in the .../genjsp directory in the WebSphere Portlet Factory file system. By default, WebSphere Portlet Factory provides protection and security constraints on HTTP requests to this directory so that it is inaccessible to users of the application. However, for the JSP Pre-Compile tool to operate, the tool must be able to make HTTP requests to this directory.

In order to run the tool you will need to disable security on the /genjsp directory. How you do this depends on the application server you are using. Some app servers have administrative tools for editing security constraints. In any case, any <security-constraint> elements in the web.xml deployment descriptors that put restrictions on the /genjsp folder need to be temporarily removed until after this tool is run.

Because the JSP pre-compile tool makes HTTP calls to the JSPs in the application server (with the precompile=true flag), the application server must be running in order for the pre-compile tool to work.

Parent topic: JavaServer pages guidelines Parent topic: web.xml processing and templates Parent topic: About working with projects


Library | Support |