一、如果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"%>