HTTP Status 500 - --------------------------------------------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
java.util.ArrayList.RangeCheck(Unknown Source)
java.util.ArrayList.get(Unknown Source)
com.test.chuchai.StoreData.duobiao(StoreData.java:76)
com.linyang.servlet.DaoRu.doPost(DaoRu.java:28)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.30 logs.

解决方案 »

  1.   

    java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
    数组越界,数组只有2个元素,也就意味着只能用 0 和 1 取值,但你程序给的是2.com.test.chuchai.StoreData.duobiao(StoreData.java:76)
    这行代码前后检查下
      

  2.   

       for(int i=1;i<=list0.size();i++){
      String sql0="select z_dl from dbxx where dbh='"+list0.get(i)+"'and yhh='"+it.getYhh()+"'";
    PreparedStatement pstm0=cm2.prepareStatement(sql0);
    ResultSet  rs0=pstm0.executeQuery();
    while(rs0.next()){
     DianL dl=new DianL();
    dl.setZ_dl(rs0.getFloat("z_dl"));
    list1.add(dl);
    }

    }
    这段去掉就没错了  敢问 这哪错了啊
      

  3.   

    for(int i=1;i<=list0.size();i++){改为:for(int i=0;i<list0.size();i++){
      

  4.   

    duobiao(StoreData.java:76)
    提示很明确,是数组越界异常,请参照代码StoreData.java的76行,
      

  5.   


    楼主以前没玩过List吧?List的get(序号)是从 0 ~ size()-1