新手请教下问题...

shirleylz 2011-05-05 06:13:05
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.io.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无标题文档</title>
</head>

<body>
<%! int number=0;
synchronized void countPeople()
{
if(number==0)
{
try
{
FileInputStream in=new FileInputStream("count.txt");
DataInputStream dataIn=new DataInputStream(in);
number=dataIn.readInt();
number++;
in.close();
dataIn.close();
}
catch(FileNotFoundExecption e)
{
number++;
try
{
FileOutputStream out =new FileOutputStream("count.txt");
DataOutputSteam dataOut=new DataOutputStream(out);
dataOut.writeInt(number);
out.close();
dataOut.close();
}
catch(IOException ee){}
}
catch(IOException ee)
{}
}
else
{
number++;
try
{
FileOutputStream out =new FileOutputStream("count.txt");
DataOutputSteam dataOut=new DataOutputStream(out);
dataOut.writeInt(number);
out.close();
dataOut.close();
}
catch(IOException e){}
catch(IOException e) {}
}
}
%>
<% countPeople();
%>
<p><p>您是第
<%=number%>
个访问本站的客户。
</body>
</html>
照着书上的弄那为什么还出现500错误。期望各位看看那里出了错,并且说下有什么快速方法处理类似的问题。
谢谢。。。
...全文
112 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
shenzongyi123 2011-05-06
  • 打赏
  • 举报
回复
这代码贴的,看的头疼!
xiongdan1982 2011-05-06
  • 打赏
  • 举报
回复
调试下,一步一步看,看是那一步出的错。
然后再来修改。
cheneyfeng3 2011-05-06
  • 打赏
  • 举报
回复
把错误信息贴出来。有问题最主要的就是看错误信息。
alongines 2011-05-06
  • 打赏
  • 举报
回复
估计是你的 count.txt 路径不对

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧