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" >