可怕的 "System.err.println("asdfdsf");"
在win2000+tomcat3.2+apache+JServ1.2上调试servlet(tunnel)程序。
数据库ResultSet错误, 使用"System.err.println("asdfdsf");"显示。
出错时,不能显示程序也暂停,必须在tomcat的操作窗口敲回车键,才能显
示并继续运行程序。
请问有无高手遭遇类似问题?how to ?
怎样判断 ResultSet!=null 但是 ResultSet中又无记录的情况???
example:
myResultSet=myStatement.executeQuery("Select * from myTable where 1>2");
如果myResultSet.next() catch不到错误。
问题点数:80、回复次数:5Top
1 楼skyyoung(路人甲)回复于 2001-03-13 09:21:00 得分 10
if(myResultSet.next()) //如果有记录
{
....
}Top
2 楼skyyoung(路人甲)回复于 2001-03-13 09:23:00 得分 10
用System.out.println("error");不行吗Top
3 楼lmy2000(pluto)回复于 2001-03-13 09:31:00 得分 20
用while比较好。
try
{
while(myResultSet.next()) //如果有记录
{
....
}
}
catch(Exception e){
System.out.println(e);
}Top
4 楼skyyoung(路人甲)回复于 2001-03-13 09:31:00 得分 40
(copy)
By default, they will go to the console where the tomcat is started. You have to modify the startup scripts to redirect them to appropriate files. See Tomcat Mailing List(http://mikal.org/interests/java/tomcat_users/msg03276.html) for a discussion on how to redirect the System.out and System.err.
On the other hand, if you are running Tomcat as an NT Service, you can modify the conf/wrapper.properties file and set wrapper.stdout and wrapper.stderr properties to point to your log files.
Top
5 楼NoWant(NoWant)回复于 2001-03-16 09:56:00 得分 0
用System.out.println("error");不行吗
的确有问题Top




