Do not use Java keywords in JSP and JSF expression language elements

This rule flags JSP expression language (EL) elements that contain variables with names that contain Java keywords or EL reserved keywords.

Starting in WebSphere Application Server Version 8, the expression language processor validation became more strict. EL variable identifiers are checked to ensure that they do not contain Java keywords or EL reserved words. If a variable identifier used in a JSTL/EL script includes either Java keywords or EL reserved words, the JSP file will not translate and a com.ibm.ws.jsp.translator.JspTranslationException is thrown at runtime.

This rule will flag any expression language element that contains variables which include any of the current set of Java reserved keywords.

The rule will also flag the use of JSP reserved words in variables.

The problem can be resolved by modifying the the JSP and Java code to eliminate the use of the reserved keywords. If this change is too extensive, a system property is available to revert to the behavior prior to Version 8. Set the JVM system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to a value of true to go back to previous behavior.

In the following example:
<c:if test="${not empty testObject}">
<c:choose>
<c:when test="${testObject.class.name eq 'SomeValue'}">

The expression language element ${testObject.class.name eq 'SomeValue'} is flagged because the variable testObject.class.name contains the Java keyword class .

If not fixed, this expression will produce a runtime error similar to:

Application Error
SRVE0777E: Exception thrown by application class 'com.ibm.ws.jsp.translator.visitor.validator.ELValidator.validateElFunction:515'
com.ibm.ws.jsp.translator.JspTranslationException: JSPG0122E: Unable to parse EL function ${testObject.class.name eq 'SomeValue'}.

If expression language processing is disabled, elements in the JSP file will not be flagged.

For example, expression language processing is disabled when the isELIgnored page directive is set to true . The rule will not flag elements in a JSP file marked with this directive.

<%@ page isELIgnored="true" %>

Expression language processing can also be disabled using the web.xml el-ignored element. In this example, webIgnored.jsp will not be flagged by this rule.

<jsp-config>
<jsp-property-group>
<url-pattern>webIgnored.jsp</url-pattern>
<el-ignored>true</el-ignored>
</jsp-property-group>
</jsp-config>

Expression language processing is always disabled for web modules at servlet version 2.3 or lower.

For additional information, see