IDEA 中无法使用 EL 表达式

一、如果 JSP 中无法自动提示 EL 表达式

例如:无法提示 ${pageContext.request.contextPath},可在 pom.xml 中添加如下依赖

<dependency>
	<groupId>javax.servlet</groupId>
	<artifactId>jsp-api</artifactId>
	<version>2.0</version>
	<scope>provided</scope>
</dependency>

二、如果 JSP 中无法使用 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"%>

  

 

原文地址:https://www.cnblogs.com/xiaomaomao/p/11905912.html