JSP run time compilation settings

By default, the JavaServer Pages (JSP) engine translates a requested JSP file, compiles the .java file, and loads the compiled servlet into the run time environment. You can change the JSP engine default behavior by indicating that a JSP file must not be translated or compiled at run time, even when a .class file does not exist.

If run time compilation is disabled, you must 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 the product

You 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, in the administrative console, click Servers > Server Types > WebSphere application servers > server_name. Then, in the Container Settings section, click Web container settings > Web container > Custom properties.

    If the disableJspRuntimeCompilation property appears in the list of defined custom properties, but is set to false, click the property name, and then set the property to true.

    If this property is not included in the list of defined custom properties, click New, and then specify disableJspRuntimeCompilation in the Name field and true in the Value field.

    Valid settings for this property are true or false. When this property is set to true, 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 page when 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 the following 404 error to the browser:
Error 404: SRVE0200E: Servlet [org.apache.jsp._jsp1]: Could not find required servlet class - _jsp1.class
[AIX Solaris HP-UX Linux Windows][IBM i]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.