我有以下JSP:
<%@ page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ page isELIgnored="false"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title><c:out value="${it.title}"/></title> </head> <body> <c:forEach var="speaker" items="${it.speakers}" varStatus="stat"> <ul> <li><c:out value="${speaker.person.firstName}" /> <c:out value="${speaker.person.lastName}" />, <c:out value="${speaker.person.address.city.zip}" /> <c:out value="${speaker.person.address.city.name}" /></li> </ul> </c:forEach> </body> </html>
Eclipse警告我代码中的每个EL Expressions实例:
Warning [line 10]: "value" does not support runtime expressions Warning [line 13]: "items" does not support runtime expressions ...
但是,事实并非如此,服务器会正确评估EL。
谁能向我暗示正确的方向,为什么日食会警告我有关这些EL表达式的信息?
您的taglib指令将导入JSTL 1.0 taglib。它应该是JSTL 1.1(请注意URI的区别):
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>