日期:2014-05-20  浏览次数:20853 次

关于java+jsp购物车添加商品的问题,,高手进来哦
提示错误:
An error occurred at line: 33 in the jsp file: /showCart.jsp
Product cannot be resolved to a type
30: { 
31: %>
32: <tr>
33: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProname()%></td>
34: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProdescr()%></td>
35: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProprice()%></td>
36: <td><a href="/demo/removeFromCart?removeId=<%=((Product)shopCart.getAllProductFromCart().get(i)).getProid()%>">???</a></td>

JSP FileName:/showCart.jsp
Java FileName:/L:/learning/dev-plam2.0/dev-plam2.0/tomcat/work/Catalina/localhost/demo//org/apache/jsp\showCart_jsp.java

An error occurred at line: 34 in the jsp file: /showCart.jsp
Product cannot be resolved to a type
31: %>
32: <tr>
33: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProname()%></td>
34: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProdescr()%></td>
35: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProprice()%></td>
36: <td><a href="/demo/removeFromCart?removeId=<%=((Product)shopCart.getAllProductFromCart().get(i)).getProid()%>">???</a></td>
37: <% }%>

JSP FileName:/showCart.jsp
Java FileName:/L:/learning/dev-plam2.0/dev-plam2.0/tomcat/work/Catalina/localhost/demo//org/apache/jsp\showCart_jsp.java

An error occurred at line: 35 in the jsp file: /showCart.jsp
Product cannot be resolved to a type
32: <tr>
33: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProname()%></td>
34: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProdescr()%></td>
35: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProprice()%></td>
36: <td><a href="/demo/removeFromCart?removeId=<%=((Product)shopCart.getAllProductFromCart().get(i)).getProid()%>">???</a></td>
37: <% }%>
38: </table>

JSP FileName:/showCart.jsp
Java FileName:/L:/learning/dev-plam2.0/dev-plam2.0/tomcat/work/Catalina/localhost/demo//org/apache/jsp\showCart_jsp.java

An error occurred at line: 36 in the jsp file: /showCart.jsp
Product cannot be resolved to a type
33: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProname()%></td>
34: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProdescr()%></td>
35: <td><%=((Product)shopCart.getAllProductFromCart().get(i)).getProprice()%></td>
36: <td><a href="/demo/removeFromCart?removeId=<%=((Product)shopCart.getAllProductFromCart().get(i)).getProid()%>">???</a></td>
37: <% }%>
38: </table>
39: </div>


bean包:
package bean;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;


public class ShopCart {
public ShopCart(){
}
private List<Product> cart=null;
//向购物车中添加产品
public void addProductToCart(Product product){
if(cart==null){
cart=new ArrayList<Product>();
}
Iterator<Product> it=cart.iterator();
//遍历察看是否有重复的同种商品