日期:2014-05-18  浏览次数:20756 次

关于jsp数组的问题
 
<% 
  ArrayList<CollegeDTO> collegeList=sb.QueryCollege();
  ArrayList<DepartmentDTO> departmentList=sb.queryAllDep();
  //Iterator<CollegeDTO> collegeIterator=collegeList.iterator();
  int i=0;
  int k=0;
  int departmentLength=departmentList.size();
  int collegeLength=collegeList.size();
  int dep[]=new int[collegeLength];
  for (i=0;i<collegeLength;i++)
  dep[i]=0;
  for (i=0;i<departmentLength;i++){
  k=collegeList.get(i).getCollegeNo();
  dep[k]=dep[k]+1;
  }
 %>
在jsp中嵌入以上一段代码,myeclipse报错如下:
org.apache.jasper.JasperException: An exception occurred processing JSP page /teacher/AddStu.jsp at line 154

151: dep[i]=0;
152: for (i=0;i<departmentLength;i++){
153: k=collegeList.get(i).getCollegeNo();
154: dep[k]=dep[k]+1;
155: }
156: %>
157:

如果dep[]有问题?

 

------解决方案--------------------
K的值有没有超过departmentLength的大小?~
我的异常网推荐解决方案:An exception occurred processing JSP page,http://www.aiyiweb.com/j2se/33144.html