JSP页面EL表达式不解析
2016-11-09 20:34
417 查看
现象如下:
经过查阅资料,有四种情况下EL表达式是无法正确别解析的,
分别是:
Application server in question doesn’t support JSP 2.0. (应用服务器不支持JSP2.0)
The web.xml is not declared as Servlet 2.4 or higher. (web.xml中servlet版本没有声明在2.4以上)
The @page is configured with isELIgnored=true. (页面上配置了<%@ page isELIgnored=”true” %> )
The web.xml is configured with true in . (web.xml中显式地配置了忽略EL表达式)
最终发现我的web.xml中声明的servlet版本是2.3,所以默认是不自动解析EL表达式的。
而我的web.xml这样是使用了maven-archetype-webapp创建的缘故。
只要更改成如下即可, 版本最好是你项目中使用的JSP版本,
总结一下:页面无法解析EL表达式是因为web.xml中JSP版本在2.4以下,而我在项目中使用的是JSP3.0,原因在于工程是通过maven-archetype-webapp创建的。
经过查阅资料,有四种情况下EL表达式是无法正确别解析的,
分别是:
Application server in question doesn’t support JSP 2.0. (应用服务器不支持JSP2.0)
The web.xml is not declared as Servlet 2.4 or higher. (web.xml中servlet版本没有声明在2.4以上)
The @page is configured with isELIgnored=true. (页面上配置了<%@ page isELIgnored=”true” %> )
The web.xml is configured with true in . (web.xml中显式地配置了忽略EL表达式)
最终发现我的web.xml中声明的servlet版本是2.3,所以默认是不自动解析EL表达式的。
而我的web.xml这样是使用了maven-archetype-webapp创建的缘故。
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> </w 4000 eb-app>
只要更改成如下即可, 版本最好是你项目中使用的JSP版本,
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> ... </web-app>
总结一下:页面无法解析EL表达式是因为web.xml中JSP版本在2.4以下,而我在项目中使用的是JSP3.0,原因在于工程是通过maven-archetype-webapp创建的。
相关文章推荐
- jsp页面无法解析EL表达式问题
- JSP页面EL表达式不解析
- jsp页面中的EL表达式不被解析的问题
- JSP页面无法解析EL表达式
- 关于解决jsp页面无法正常解析EL表达式的问题
- jsp页面无法解析el表达式
- jsp页面中的EL表达式不被解析的问题
- jsp页面中的EL表达式不被解析的问题
- jsp页面中的EL表达式不被解析的问题
- jsp页面中的EL表达式不被解析的问题
- jsp页面EL表达式不被解析问题总结
- jsp页面中的EL表达式不被解析的问题
- jsp页面EL表达式不被解析的解决方法
- JSP页面无法解析EL表达式
- jsp页面中的EL表达式不被解析
- jsp页面中EL表达式不能被解析
- struts2框架在jsp页面无法解析EL表达式的问题解决
- jsp页面中的EL表达式不被解析的问题
- jsp页面获取参数的方法(url解析、el表达式赋值、session取值)【原创】
- jsp页面中的EL表达式不被解析的问题