我浏览了许多有关此异常的链接。不知道是action类有问题还是jsp有问题。
我的 DAO 是:
{
ReleaseData releaseData = new ReleaseData();
releaseData.setRollno(resultSet.getInt("rollno"));
releaseData.setName(resultSet.getString("name"));
releaseData.setAge(resultSet.getInt("age"));
myDataList.add(releaseData);
System.out.println("the List has---"+myDataList);
}
我的 Servlet 是:
public class DisplayServlet extends HttpServlet
{
public void doGet(HttpServletRequest request ,HttpServletResponse response) throws ServletException,IOException
{
List<ReleaseData> myDataList = new ReleaseDataDAO().getReleaseData();
request.setAttribute("myDataList", myDataList);
request.getRequestDispatcher("/showData.jsp").forward(request, response);
}
}
这是我的jsp:
<c:forEach items="$(myDataList)" var="data">
<tr>
<td>${data.rollno}</td>
<td>${data.name}</td>
<td>${data.age}</td>
</tr>
</c:forEach>