Disable JavaServer Pages run-time compilation

By default, the JSP engine translates a requested JSP file, compiles the .java file, and loads the compiled servlet into the run-time environment. We can change the JSP engine default behaviour by indicating a JSP file should never be translated or compiled at run-time, even when a .class file does not exist.

If run-time compilation is disabled, precompile the JSP files, which provides the following advantages:

  • Reduces compilation related disk operations.

  • Minimizes disk storage requirements necessary for handling temporary .java files generated during a run-time compilation.

  • Allows you to not include the JSP source files in the application.

  • Allows verification that a JSP file compiled successfully before deploying and installing the application in WebSphere Application Server.

We can disable run-time JSP file compilation on a global or an individual Web application basis:

  • To disable the translation and compilation of JSP files for all Web applications, set the Web container custom property disableJspRuntimeCompilation to true.

    Set this property through the Web container Custom properties panel in the administrative console. To view this administrative console page, click:

    Servers | Application servers | servername | Web container settings | Web container | Custom properties | property_name

    Valid values for this setting are true or false. If this property is set to true, then translation and compilation of the JSP files is disabled at run time for all Web applications.

  • To disable the translation and compilation of JSP files for a specific Web application, set the JSP engine initialization parameter disableJspRuntimeCompilation to true. This setting, if enabled, determines the run-time behavior of the JSP engine and overrides the Web container custom property setting.

    Set this parameter through the JavaServer Pages attribute assembly settings panel in the Assembling applications.

    Valid values for this setting are true or false. If this parameter is set to true, then, for that specific Web application, translation and compilation of the JSP files is disabled at run time, and the JSP engine only loads precompiled files.

  • If neither the Web container custom property nor the JSP parameter is set, the first request for a JSP file results in the translation and compilation of the JSP file when the .class file does not exist or is outdated. Subsequent requests for the file also result in translations and compilations, but only if the following conditions are met:

    • Translations are required because the .class file is outdated.
    • Reloading is enabled for the Web module.
    • Reload interval is exceeded.

If you disable run-time compilation and a request arrives for a JSP file that does not have a matching .class file, the JSP engine returns HTTP error 500 (Internal server error) to the browser. In this case, an exception is written to the System Out (SYSOUT) and First Failure Data Capture (FFDC) logs.

If a JSP file has a matching .class file but that file is out of date, the JSP engine still loads the .class file into memory.


 

See Also


JavaServer Pages

 

Related Tasks


Developing Web applications

 

See Also


Custom property settings