JSPs runtime reloading settings


 

+

Search Tips   |   Advanced Search

 

JSP reloading at runtime is enabled by editing

WEB-INF/ibm-web-ext.xmi

...and setting...

<jspAttributes xmi:id="JSPAttribute_1" name="reloadEnabled" value="true"/>

Reload settings...

Attribute Production Development
reloadEnabled false true
reloadInterval N/A Approximately 5 seconds
trackDependencies N/A True. Alternatively, set false to improve response time if dependencies are not changing
disableJspRuntimeCompilation True. Alternatively, set to false if JSPs are not pre-compiled and therefore need to be compiled on the first request. false

If reloadEnabled is set to true, a JSP file is reloaded at run time if the JSP file and its class file do not have the same timestamp.

If trackDependencies is set to true then the JSP file is reloaded if the timestamp of any of its dependencies has changed since the JSP class file was last generated. If reloadEnabled is set to false, a JSP file is still compiled if necessary on the first request to it unless disableJspRuntimeCompilation is true.

For example, when disableJspRuntimeCompilation is false and reloadEnabled is false, a JSP file is compiled on the first request if the class file is outdated.

It would not compiled on subsequent requests even if the JSP source file is modified or the class file is deleted unless reloadEnabled is true

 

Reload interval

The reload interval is set through the reloadInterval...

<jspAttributes xmi:id="JSPAttribute_1" name="reloadInterval" value="5"/>

If reloading is enabled, reloadInterval value determines the delay between checks to see if a JSP file is outdated. For example, if reloadInterval is 5, the JSP engine checks to see if a JSP file is outdated only when the last such check was done more than five seconds prior to the current request for the JSP file. Once the reloadInterval is exceeded, reload checking is performed and the reload interval timer is reset to 0 for that JSP file.

The larger the reloadInterval, the less frequently the JSP engine checks for the need to reload a JSP file.

 

Dependency tracking

Dependency tracking is set through the trackDependencies JSP engine parameter:

<jspAttributes xmi:id="JSPAttribute_1" name="trackDependencies" value="true"/>

If reloading is enabled, trackDependencies value determines whether the JSP engine tracks modifications to the requested JSP file dependencies as well as to the JSP file itself.

The three types of dependencies tracked by the JSP engine are:

Dependency tracking information is always included in the generated class file even if trackDependencies is false. The information is not used by the JSP engine or batch compiler unless trackDependencies is true. This means that we can enable dependency tracking without having to recompile JSPs.

For example, the toplevel.jsp file statically includes the footer.jspf file. When the toplevel.jsp file is compiled, the path to the footer.jspf file and its timestamp are stored in the toplevel.jsp's class file. As a result, the footer.jspf file is modified and the toplevel.jsp file is requested. Now that the reload interval for the toplevel.jsp file has been exceeded, the JSP engine compares the timestamp stored in the class file with the footer.jspf file timestamp on disk. Because the timestamps are different, the toplevel.jsp file is compiled, picking up the modification to the footer.jspf file.

In order for dependency tracking to work, the trackDependencies value must be set to true at the time a JSP file is requested at run time or is processed by the batch compiler.

 

Disable compilation

Disablement of run time compilation of JSPs is set via the disableJspRuntimeCompilation JSP engine parameter:

<jspAttributes xmi:id="JSPAttribute_1" name="disableJspRuntimeCompilation" value="true"/>

If disableJspRuntimeCompilation is set to true, the JSP engine at run time does not translate and compile JSPs; the JSP engine loads only precompiled class files. JSP source files do not need to be present in order for the class files to be loaded. With this option set to true, an application can be installed without JSP source, but must have precompiled class files. There is a Web container custom property of the same name that can be used to determine the behavior of all web modules installed in a server.

If both the Web container custom property and the JSP engine option are set, the JSP engine option takes precedence. Setting disableJspRuntimeCompilation to true automatically sets reloadEnabled to false.

 

Reload processing sequence

The processing sequence pertaining to JSP file reloading when trackDependencies is false.

When trackDependencies is true, the JSP engine does additional file system processing to determine if any of a JSP file's dependencies have changed since the JSP file was last translated and compiled.

Additional processes are performed on the 'No' path of the flow chart labeled...

is JSP class file outdated?

We can see that the path taken when disableJspRuntimeCompilation is true is the most efficient path.





 

Related tasks

Set JSP engine parameters

 

Related

JSP engine configuration parameters
Custom property settings
Web container custom properties