您的位置:首页 > 其它

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

2011-03-31 15:19 501 查看
严重: 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
页面上的源码如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>employee</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

</head>

<body>
ONGL:
<s:iterator value="#request.employees">
<s:property value="username"/>,<s:property value="password"/>,<s:property value="gender"/>
</s:iterator>
<br/>

JSTL/EL:
<c:forEach items="${employees}" var="employee">
${employee.username}, ${employee.password}, ${employee.gender}<br/>
</c:forEach>
</body>
</html>


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

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


改为:

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


一定要记得加引号!
就输出正常了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐