方法 1:添加 isELIgnored
在 Maven 项目中的每个 JSP 页面添加以下语句,否则将无法解析 EL 表达式
<%@ page isELIgnored="false" %>
以下为 EL 表达式示例:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<table>
<table width="%80" border="1" height="56">
<tr align="center">
<td>用户名</td>
<td>用户密码</td>
<td>用户年龄</td>
</tr>
<c:forEach var="users" items="${userList}">
<tr align="center">
<td>${users.username }</td>
<td>${users.password }</td>
<td>${users.age }</td>
</tr>
</c:forEach>
</table>
方法 2 :修改 web.xml
将 Maven 工程默认的 web.xml 头部这一段
<!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>
替换成如下格式
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0" metadata-complete="true">