当前位置: 代码迷 >> Java Web开发 >> 关于jsp数组的有关问题
  详细解决方案

关于jsp数组的有关问题

热度:309   发布时间:2016-04-17 01:35:47.0
关于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.daimami.com/search?q=33144
  相关解决方案