用for循環(huán)就報(bào)錯
四月 20, 2015 9:49:18 上午 org.apache.catalina.core.StandardWrapperValve invoke
嚴(yán)重: Servlet.service() for servlet [jsp] in context with path [/test1] threw exception [An exception occurred processing JSP page /requstTest.jsp at line 33
30: ? ?<%?
31: ? ? ?String[] Aihao= request.getParameterValues("aihao");
32: ? ? ?for(int i=0;i<=Aihao.length;i++){
33: ? ? ?if(Aihao[i]==null){
34: ? ? ?out.println("浣犱斧鐨勬病杈撳叆鐖卞ソ銆傘?傛垜浠?庝箞鐜╋紵");
35: ? ? ?}
36: ? ? ?out.println(Aihao[i]);}
Stacktrace:] with root cause
2015-04-20
for循環(huán)中i<=Aihao.length;改為i<Aihao.length,數(shù)組的下標(biāo)最大也就是數(shù)組長度-1