一、如果JSP中无法自动提示EL表达式,比如${pageContext.request.contextPath},可在pom.xml的<dependencies>标签中插入以下代码
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>二、如果无法使用EL表达式 方法1:更改web.xml的web-app标签中的命名空间,可改成如下
<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"
</web-app>方法2:在jsp页面开头添加
<%@ page isELIgnored="false"%>
本文介绍了如何解决JSP页面中EL表达式无法正常使用的问题。提供了两种方法:一种是在项目的pom.xml文件中添加依赖;另一种是在web.xml文件中修改命名空间,并在JSP页面上设置EL表达式的使用属性。
699





