日期:2014-05-17  浏览次数:20596 次

jstl标签访问HashSet集合
studentInfo中的属性都可以访问到,但是set集合访问不到,集合我已经加了相应的泛型,还是于事无补.
我用的是hibernate+struts2,求高手解答,

异常如下:
Java code

org.apache.jasper.el.JspPropertyNotFoundException: /index.jsp(71,8) '${s.tblscores}' Property 'tblscores' not found on type com.sg.hibernate.util.TblStudent


JSP代码如下:
Java code
 
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.sg.hibernate.util.TblScore"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href=" <%=basePath%>">

<title>My JSP 'index.jsp' starting page </title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<center>
<h1>
添加学生
</h1>
<form action="addStudent.action" method="post">
学生姓名:
<input type="text" name="stuName">
<input type="submit" value="添加">
</form>
<c:if test="${null!=studentInfo}">
<table>
<tr>
<td>
学生ID
</td>
<td>
学生姓名
</td>
<td>
删除学生
</td>
<td>
数学
</td>
<td>
英语
</td>
<td>
语文
</td>
<td>
政治
</td>
</tr>
<c:forEach items="${requestScope.studentInfo}" var="s">
<tr>
<td>
${s.stid}
</td>
<td>
${s.sname}
</td>
<td>
<a href="deleteStudent.action?stuId=${s.stid}">
删除
</a>
</td>
<td>
${s.tblscores }
</td>
</tr>
</c:forEach>
</table>
</c:if>
</center>
</body>
</html>


------解决方案--------------------
${s.tblscores } 集合有这个对象吗?