我有一个List<Products>
其中包含我的产品表的数据。在 servlet 上我得到这个 List<Products>
。我通过以下代码将此列表传递给 JSP:
List<Products>Products=new SessionBeanClass().DisplayProducts(arr);
request.setAttribute("Products",Products);
request.getRequestDispatcher("sample2.jsp").forward(request, response);
我通过以下代码在 JSP 上显示 LIST 的数据:
<c:forEach items="${requestScope['Products']}" var="emp" >
<table>
<tr>
<td> ${emp.getPrice()} </td>
</tr>
</table>
</c:forEach>
但是当我这样写
<c:forEach items="${requestScope['Products']}" var="emp" >
<table>
<tr>
<td> ${emp.Price()} </td>
</tr>
</table>
</c:forEach>
它向我显示一个错误
javax.el.PropertyNotFoundException 'Price' not found
为什么?
最佳答案
改变
${emp.Price()}
到
${emp.price}
关于jsp 上的 javax.el.PropertyNotFoundException 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23617691/