当前位置: 技术问答>java相关
做bbs所遇到的问题!!!!
来源: 互联网 发布时间:2015-06-02
本文导语: javax.servlet.ServletException: Compilation error occured: Found 12 errors in JSP file: :129: Error: Type IOException was not found. :131: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but it...
javax.servlet.ServletException: Compilation error occured:
Found 12 errors in JSP file:
:129: Error: Type IOException was not found.
:131: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:134: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:136: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:137: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:138: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:139: Error: The method "void print(java.lang.Object $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:140: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:141: Error: The method "void print(int $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
错误是这样的:142: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:143: Error: The method "void print(int $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:144: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
源代码为:String serial;
String title;
String speaker;
Date providedate;
int reply;
int click;
String ReSign;
ResultSet RS;
mydb.mydb.mydb1.executeQuery("select * from article where parent_no=0");
while (RS.next()) {
ReSign="";
out.print("");
serial=RS.getString("serial_no");
title=RS.getString("title");
speaker=RS.getString("speaker");
providedate=RS.getDate("provide_time");
reply=RS.getInt("reply_num");
click=RS.getInt("click_num");
showing(request,out,ReSign,serial,title,speaker,providedate,reply,click);
//--------------------------ÕâÀïÒªÏÔʾÏÂÒ»¼¶µÄ»Ø¸´ÄÚÈÝ
ResultSet RS1 = workM.executeQuery("select * from article where parent_no=" + serial);
while (RS1.next()) {
ReSign=" Re:";
out.print("");
serial=RS1.getString("serial_no");
title=RS1.getString("title");
speaker=RS1.getString("speaker");
providedate=RS1.getDate("provide_time");
reply=RS1.getInt("reply_num");
click=RS1.getInt("click_num");
showing(request,out,ReSign,serial,title,speaker,providedate,reply,click);
}
RS1.close();
workM.closeStmt();
//------------------------
}
out.print("");
RS.close();
workM.closeStmt();
%>
·µ»ØÖ÷Ò³
Found 12 errors in JSP file:
:129: Error: Type IOException was not found.
:131: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:134: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:136: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:137: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:138: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:139: Error: The method "void print(java.lang.Object $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:140: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:141: Error: The method "void print(int $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
错误是这样的:142: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:143: Error: The method "void print(int $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
:144: Error: The method "void print(java.lang.String $1);" can throw the checked exception "java/io/IOException", but its invocation is neither enclosed in a try statement that can catch that exception nor in the body of a method or constructor that "throws" that exception.
源代码为:String serial;
String title;
String speaker;
Date providedate;
int reply;
int click;
String ReSign;
ResultSet RS;
mydb.mydb.mydb1.executeQuery("select * from article where parent_no=0");
while (RS.next()) {
ReSign="";
out.print("");
serial=RS.getString("serial_no");
title=RS.getString("title");
speaker=RS.getString("speaker");
providedate=RS.getDate("provide_time");
reply=RS.getInt("reply_num");
click=RS.getInt("click_num");
showing(request,out,ReSign,serial,title,speaker,providedate,reply,click);
//--------------------------ÕâÀïÒªÏÔʾÏÂÒ»¼¶µÄ»Ø¸´ÄÚÈÝ
ResultSet RS1 = workM.executeQuery("select * from article where parent_no=" + serial);
while (RS1.next()) {
ReSign=" Re:";
out.print("");
serial=RS1.getString("serial_no");
title=RS1.getString("title");
speaker=RS1.getString("speaker");
providedate=RS1.getDate("provide_time");
reply=RS1.getInt("reply_num");
click=RS1.getInt("click_num");
showing(request,out,ReSign,serial,title,speaker,providedate,reply,click);
}
RS1.close();
workM.closeStmt();
//------------------------
}
out.print("");
RS.close();
workM.closeStmt();
%>
·µ»ØÖ÷Ò³
|
你可以用错误处理来显示你的错误,我觉得你的错误是没有验证错误处理
try{}
catch{}
加上试试
try{}
catch{}
加上试试
|
你好象没有导入 java.io.IOException类,加入再试
|
我觉得问题好象不在io,执行io的操作只有一句 out.print();
而这个属于jsp的内部对象,不用加载的。但显示的问题错误确出在
io上,不清楚
而这个属于jsp的内部对象,不用加载的。但显示的问题错误确出在
io上,不清楚
|
在jsp文件的头部加入