关于JSP中EL表达式失效的解决办法

1、确保web.xml版本支持

首先确保web.xml的版本支持。一般来说以下两个均可

<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_2_5.xsd"
	id="WebApp_ID" version="2.5" >
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

2、手动配置web.xml中对EL表达式的支持

<!--开启EL表达式-->
    <jsp-config>
        <jsp-property-group>
            <url-pattern>/*</url-pattern>
            <el-ignored>false</el-ignored>
        </jsp-property-group>
    </jsp-config>

3、在jsp页面中配置对EL表达式的支持

<%@page isELIgnored="false" %>

猜你喜欢

转载自blog.csdn.net/weixin_40516653/article/details/84393943
今日推荐