Use Scoped Variables in JSP Templates and Tag Files

Unified Expression Language (EL) 3.0 supports referencing static fields and methods. To enable this in JSPs, the javax.servlet.jsp.el.ScopedAttributeELResolver was updated to check if identifiers match imported class or field names. [1]

This change impacts performance when you reference unscoped, undefined variables. In particular, tag files often use optional attributes, which can trigger this issue. To avoid performance degradation, always specify the variable scope in your JSPs and tag files.

For variables provided by components, use requestScope. For tag file attributes, use pageScope.

For example, instead of:

${undefinedVariable}

use:

${requestScope.undefinedVariable}

or

${pageScope.undefinedVariable}

Always scope your variables to prevent performance issues. While you may only need to update your most frequently used JSPs and tag files, consistently scoping variables allows you to rule out this problem during performance troubleshooting.

References

1

Share Feedback
Page: /build/web-application/use-scoped-variables-in-jsp-templates-and-tag-file
Section: Build
Category *
Use Scoped Variables in JSP Templates and Tag files | Bloomreach Content Documentation