天天看點

JSF不能解析El表達式

JSF工程在部署後,頁面不能解析El表達式,及所有的JSF标簽。

如:

在通路的時候顯示成#{initParam['SYSPARAM_WindowTitle']}。

解決方法1:

確定web.xml中定義的版本是2.5或以上的。

注意改完後要清理tomcat work目錄才能生效。

解決方法2:

在頁面上加入

<%@ page isELIgnored="false" %>
           

問題原因:

JSP 2.0中,如果web-app版本為2.4或者以上的話isELIgnored預設為false, 以前的版本預設為true,需要手動在頁面上加入

<%@ page isELIgnored="false" %>
           

下面是官方Documention中isELIgnored Attribute的詳解:

The isELIgnored Attribute

• Format

– <%@ page isELIgnored="false" %>

– <%@ page isELIgnored="true" %>

Purpose

– To control whether the JSP 2.0 Expression Language

(EL) is ignored (true) or evaluated normally (false).

• Notes

– If your web.xml specifies servlets 2.3 (corresponding to

JSP 1.2) or earlier, the default is true

• But it is still legal to change the default—you are permitted

to use this attribute in a JSP-2.0-compliant server

regardless of the web.xml version.

– If your web.xml specifies servlets 2.4 (corresponding to

JSP 2.0) or earlier, the default is false