Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 这段程序哪里错了?('try' without 'catch' or 'finally')
yangxg_a





发贴: 17
于 2005-11-27 13:59 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
下面这段程序哪里错了啊?

<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.io.*" %>
<HTML>
<BODY BGCOLOR=cyan><FONT Size=4>
<%!
int number=0;
File file=new File("count.txt");
synchronized void countPeople()//计算访问次数的同步方法
{
if(!file.exists())
{
number++;
try{
file.createNewFile();
FileOutputStream Out=new FileOutputStream("count.txt");
DataOutputStream dataOut=new DataOutputStream(out);
dataOut.writeInt(number);
out.close();
dataOut.close();
}
catch(IOException ee){}
}
else
{
try{
FileInputStream in=new FileInputstream("count.txt");
DataInputStream dataIn=new DataInputStream(in);
number=dataIn.readInt();
number++;
in.close();
dataIn.close();
FileOutputStream out=new FileOutputStream("count.txt");
DataOutputStream dataOut=new DataOutputStream(out);
dataOut.writeInt(number);
out.close();
dataOut.close();
}
}
catch(IOException ee){}
}
}
%>
<%
countPeople();
%>
<P><P>您是第
  <%=number%>
个访问本站的客户。
</FONT>
</BODY>
</HTML>

错误提示是:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 5 in the jsp file: /Example2_3.jsp
Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:31: 'try' without 'catch' or 'finally'
try{
^

An error occurred at line: 5 in the jsp file: /Example2_3.jsp
Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:45: 'catch' without 'try'
catch(IOException ee){}
^

Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:49: 'class' or 'interface' expected
private static java.util.Vector _jspx_dependants;
^

Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:51: 'class' or 'interface' expected
public java.util.List getDependants() {
^

Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:111: 'class' or 'interface' expected
}
^

Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:112: 'class' or 'interface' expected
^

Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:8: org.apache.jsp.Example2_005f3_jsp should be declared abstract; it does not define getDependants() in org.apache.jsp.Example2_005f3_jsp
public final class Example2_005f3_jsp extends org.apache.jasper.runtime.HttpJspBase
^

An error occurred at line: 5 in the jsp file: /Example2_3.jsp
Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:22: cannot resolve symbol
symbol : variable out
location: class org.apache.jsp.Example2_005f3_jsp
DataOutputStream dataOut=new DataOutputStream(out);
^

An error occurred at line: 5 in the jsp file: /Example2_3.jsp
Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:24: cannot resolve symbol
symbol : variable out
location: class org.apache.jsp.Example2_005f3_jsp
out.close();
^

An error occurred at line: 5 in the jsp file: /Example2_3.jsp
Generated servlet error:
E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:32: cannot resolve symbol
symbol : class FileInputstream
location: class org.apache.jsp.Example2_005f3_jsp
FileInputStream in=new FileInputstream("count.txt");
^
10 errors

  org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
  org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
  org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
  org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


why edited on 2005-11-27 23:54


话题树型展开
人气 标题 作者 字数 发贴时间
2858 这段程序哪里错了?('try' without 'catch' or 'finally') yangxg_a 5352 2005-11-27 13:59
2150 Re:这段程序哪里错了? yangxg_a 10 2005-11-27 16:04
2065 Re:这段程序哪里错了? why 82 2005-11-28 00:04
2212 Re:这段程序哪里错了? yangxg_a 139 2005-11-28 09:53
2124 Re:这段程序哪里错了? yangxg_a 23 2005-11-27 18:55
2030 Re:这段程序哪里错了? why 729 2005-11-27 23:56

reply to postflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923