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

eastsun_genius 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>
...全文
97 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
eastsun_genius 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>
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2004-09-07 03:50
社区公告
暂无公告