idea中發現使用不了el表達式,對比了朋友的代碼一模一樣,用了半天的時間終于知道了原因,用第二種方法解決了問題,如下:
方法一:
jsp檔案中加上以下指令:
<%--是否禁用el表達式,true為禁用,false為開啟--%>
<%@page isELIgnored="false" %>
方法二:
在web.xml 中将web.xml的web-app起始标簽替換為以下頭部,
<?xml version="1.0" encoding="UTF-8"?>
<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" metadata-complete="false" >