不对之处请指正!
Vector v=new Vector();
    Vector w=new Vector();
    Vector p=new Vector();
             try{         
             sql0="select mctfanswer, shortanswer from questions where classid='"+courseid+"' and  type='"+type+"' order by assignid";
             stmt0=con.createStatement();
             result0=stmt0.executeQuery(sql0);
             while(result0.next())
             {
       String mctf=result0.getString(1);
       String shortanswer=result0.getString(2);
           Vector rows=new Vector(2,1);
           rows.addElement(mctf);
       rows.addElement(shortanswer);
           v.addElement(rows);
           }
             result0.close();
             stmt0.close(); 
      }catch (SQLException Ex) {
     out.println("query questions failed");
         }          try{
          sql1="select mctfanswer,shortanswer from submittedqs where classid='"+courseid+"'  and type='"+type+"' and userid='"+userid+"' order by assignid";
          stmt01=con.createStatement();
  result01=stmt01.executeQuery(sql1);
  while(result01.next())
 {
 String submctf=result01.getString(1);
     String subshort=result01.getString(2);
         Vector rows0=new Vector(2,1);
         rows0.addElement(submctf);
     rows0.addElement(subshort);
         w.addElement(rows0);
              }
             result01.close();
             stmt01.close(); 
 }catch (SQLException Ex) {
out.println("query questions failed");
              } 


          
            try{         
             sql10="select points from questions where classid='"+courseid+"' and session='"+section+"' and type='"+type+"' order by assignid";
             stmt0=con.createStatement();
             result0=stmt0.executeQuery(sql0);
             while(result0.next())
    {
          points=result0.getInt(1);  
              Vector rows1=new Vector(1,1);
  rows1.addElement(points);
  p.addElement(rows1);
             }     
             result01.close();
             stmt01.close(); 
     }catch (SQLException Ex) {
out.println("query questions failed");
}
for(int i=1;i<v.size() ;i++){     
              if(v.equals(w)){
  points=Integer.parseInt(rows1.elementAt(i));
              points+=points;

                   }

解决方案 »

  1.   

    报错
    org.apache.jasper.JasperException: Unable to compile class for JSPC:\tomcat\work\localhost_8080%2Fcom\_0002fusdl_0002fstudent_0002fTestResults_0002ejspTestResults_jsp_60.java:660: Incompatible type for method. Can't convert int to java.lang.Object.
                       rows1.addElement(points);
                                        ^
    C:\tomcat\work\localhost_8080%2Fcom\_0002fusdl_0002fstudent_0002fTestResults_0002ejspTestResults_jsp_60.java:670: Undefined variable or class name: rows1
                       points=Integer.parseInt(rows1.elementAt(i));
                                               ^
    2 errors
      

  2.   

    rows1要放在while外面定义
    points好象没有定义
    int points=0;
      

  3.   

    补充:不是因为POINTS没定义,而且定义为INT是不行的,VECTOR里要放OBJECT,比如INTEGER是可以的.
    ROWS1定义在了WHILE里,那在外面就不能用了.
      

  4.   

    你是想比较整个数组还是比较数组中的元素?
    我感觉你的v和w,p都是多余的啊不是已经有row0和rows,row1了吗?
      

  5.   

    if(v.elementAt(i).equals(w.elementAt(i)))