idea的web項目中,isELIgnored預設為false,即el表達式有效,
而maven項目中,isELIgnored預設為true,需要額外設定
1.在需要使用el表達式的頁面中,設定isELIgnored="false"
<%@page language="java" contentType="text/html;charset=utf-8" isELIgnored="false"%>
2.在pom.xml中添加依賴,并設定web.xml
pom.xml:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
修改web.xml,改為:
<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">
...
</web-app>