页面死在那里,进度条走了一半不动了

挨踢啊挨踢 2004-09-07 03:50:44
我刚接触jsp,在按部就班的照着书测试代码呢,其他代码都可以运行,可就是有的页面死在那里,进度条走了一半不动了。有可能是什么原因呢,谢谢。
<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.io.*" %>
<html><body>
<% File dir=new File("C:/Tomcat5.0","tdh");
dir.mkdir();
File f=new File(dir,"tdh.txt");
try
{
FileOutputStream outfile=new FileOutputStream(f);
BufferedOutputStream bufferout=new BufferedOutputStream(outfile);
byte b[]="hello,i am glad to see you!<br> nice to meet you".getBytes();
bufferout.write(b);
bufferout.flush();
bufferout.close();
outfile.close();
FileInputStream in=new FileInputStream(f);
BufferedOutputStream bufferin=new BufferedOutputStream(in);
byte c[]=new byte[90];
int n=0;
while((n=bufferin.read(c))!=-1)
{
String temp=new String(c,0,n);
out.print(temp);
}
bufferin.close();
in.close();
}
catch(IOException e)
{}
%>
</body></html>
...全文
151 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
挨踢啊挨踢 2004-09-07
  • 打赏
  • 举报
回复
谢谢,确实是那错了,再就是d:\\temp而不是d:\temp;还有我重起了服务器才成的。谢谢
LxcJie 2004-09-07
  • 打赏
  • 举报
回复
是程序错了

<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.io.*" %>
<html><body>
<%
File dir=new File("d:\\temp","tdh");
dir.mkdir();
File f=new File(dir,"tdh.txt");
try
{
FileOutputStream outfile=new FileOutputStream(f);
BufferedOutputStream bufferout=new BufferedOutputStream(outfile);
byte b[]="hello,i am glad to see you!<br> nice to meet you".getBytes();
bufferout.write(b);
bufferout.flush();
bufferout.close();
outfile.close();
FileInputStream in=new FileInputStream(f);
BufferedInputStream bufferin=new BufferedInputStream(in);//源程序这里错了
byte c[]=new byte[90];
int n=0;
while((n=bufferin.read(c))!=-1)
{
String temp=new String(c,0,n);
out.print(temp);
}
bufferin.close();
in.close();
}
catch(IOException e)
{}
%>
</body></html>

81,092

社区成员

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

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