<c:forEach>得不到值
在listern里面 关键代码是这样的
ResultSet rs=st.executeQuery("select * from w_goods ");
while(rs.next())
{
vrs.addElement(rs.getString("NAME"));
}
}
catch(Exception ex)
{ex.toString();}
System.out.print(vrs.get(2));
session.getServletContext().setAttribute("result",vrs);
}
经过测试,vector里面已经是获取到值了的
下面是jsp代码
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ page contentType="text/html;charset=GBK"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>untitled</title>
</head>
<body><c:forEach items="${result}" var="lb">
<tr><td><c:out value="${lb.name}"></c:out>
</td>
</tr>
</c:forEach>
</body>
</html>
以下是报错信息:
javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "value" with value "${lb.name}": Unable to find a value for "name" in object of class "java.lang.String" using operator "." (null)
我知道这个错误是说JSP得不到值.可为什么呢?真的搞不懂.请大家帮忙看看!谢过!
[此贴子已经被作者于2007-3-15 15:06:30编辑过]