我在SERVLET創建一個HashMap如下:的Hashmap錯誤:javax.el.PropertyNotFoundException
int productId = Integer.parseInt(request.getParameter("productId"));
HashMap cartList = new HashMap();
Cart item = new Cart(productId, productName, price, quantity);
cartList.put(productId, item);
但我得到以下錯誤:
org.apache.jasper.JasperException: javax.el.PropertyNotFoundException: The class 'java.util.HashMap$Entry' does not have the property 'productId'.
是什麼意思?我如何解決我的錯誤?
編輯:這是我的JSP
<c:forEach var="cart" items="${cartList}">
${cart.productId}
${cart.productName}
<form method="POST" action="ShoppingCartUpdate">
<input type="submit" value ="Update" class="loginButton" name="Update">
</form>
<form method="POST" action=""ShoppingCartRemove">
<input type="submit" value ="Remove" class="loginButton" name="Delete">
</form>
</c:forEach>
可以請你告訴我們JSP代碼 – 2011-03-16 13:04:50
什麼JSP代碼扔的錯誤? – skaffman 2011-03-16 13:05:26
相關:http://stackoverflow.com/questions/924451/jstl-access-a-map-value-by-key – 2011-03-16 13:19:43