您的位置:首页 > 其它

今天在做一个SSH整合测验时发现了一个异常(According to TLD or attribute directive in tag file)

2015-10-22 17:43 423 查看
严重: Servlet.service() for servlet jsp threw exception

org.apache.jasper.JasperException: /WEB-INF/page/employee.jsp(24,3) According to TLD or attribute directive in tag file, attribute items does not accept any expressions

页面上的源码如下:

1 <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2  <%@ taglib uri="/struts-tags" prefix="s" %>
3  <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
4  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 <html>
6   <head>
7
8     <title>employee</title>
9
10     <meta http-equiv="pragma" content="no-cache">
11     <meta http-equiv="cache-control" content="no-cache">
12     <meta http-equiv="expires" content="0">
13
14   </head>
15
16   <body>
17    ONGL:
18        <s:iterator value="#request.employees">
19            <s:property value="username"/>,<s:property value="password"/>,<s:property value="gender"/>
20     </s:iterator>
21     <br/>
22
23    JSTL/EL:
24    <c:forEach items="${employees}" var="employee">
25        ${employee.username}, ${employee.password}, ${employee.gender}<br/>
26    </c:forEach>
27   </body>
28 </html>


异常提示,在第24行的时候发生错误,说不接受任何表达式,后来在网上找到一个解决方案,说是版本不支持EL,所以把

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>


改为:

<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>


一定要记得加引号!

就输出正常了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: