没有valuebean的包 引入包错误

解决方案 »

  1.   

    valuebean必须在classpath中才行,看看环境变量的设置和valuebean文件夹的路径
      

  2.   

    package toolbean;import java.util.ArrayList;
    import valuebean.GoodsSingle;
    public class ShopCar {
    private ArrayList buylist = new ArrayList();
    public ArrayList getBuylist(){
    return buylist;
    }
    /**
     * @功能 向购物车中添加商品
     * @参数single为GoodsSingle类对象,封装了要添加的商品信息
     */
    public void addItem(GoodsSingle single){
    if(single!=null){
    if(buylist.size()==0){
    GoodsSingle temp = new GoodsSingle();
    temp.setName(single.getName());
    temp.setPrice(single.getPrice());
    temp.setNum(single.getNum());
    buylist.add(temp);
    }
    else{
    int i=0;
    for(;i<buylist.size();i++){
    GoodsSingle temp=(GoodsSingle)buylist.get(i);
    if(temp.getName().equals(single.getName())){
    temp.setNum(temp.getNum()+1);
    break;
    }
    }
    if(i>=buylist.size()){
    GoodsSingle temp = new GoodsSingle();
    temp.setName(single.getName());
    temp.setPrice(single.getPrice());
    temp.setNum(single.getNum());
    buylist.add(temp);
    }
    }
    }

    }
    /**
     * @功能 从购物车中移除指定名称的商品
     * @参数 name表示商品名称
     */
    public void removeItem(String name){
    for(int i=0;i<buylist.size();i++){
    GoodsSingle temp = (GoodsSingle)buylist.get(i);
    if(temp.getName().equals(MyTools.toChinese(name))){
    if(temp.getNum()>1){
    temp.setNum(temp.getNum()-1);
    break;
    }else
    if(temp.getNum()==1){
    buylist.remove(i);
    }
    }

    }

    }
    /**
     * @功能 清空购物车
     */
    public void clearCar(){
    buylist.clear();
    }
    }是真的看不懂,各位指导下