我經歷了一些關於這個異常的鏈接。我不知道動作類是否有問題或者jsp。javax.el.PropertyNotFoundException:在類型java.lang.String中找不到屬性'rollno'
吾道:
{
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>
'ReleaseData'是public class with public valid accessor for rollno? –
使用$(myDataList)而不是$ {myDataList} –