主题:关于文件读写的问题 404异常
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.io.*"%>
<HTML>
<BODY>
<%
BufferedReader file;
String countFile="countfile.txt";
file=new BufferedReader(new FileReader(countFile));
String readStr=null;
int writeStr=1;
try
{
readStr=file.readLine();
}
catch(IOException e)
{
System.out.println("数据读取错误!");
}
if(readStr==null)
readStr="没有任何纪录。";
else
{
writeStr=Integer.parseInt(readStr)+1;
}
try
{
PrintWriter pw;
pw=new PrintWriter(new FileOutputStream(countFile));
pw.println(writeStr);
pw.close();
}
catch(IOException e)
{
out.println(e.getMessage());
}
%>
这个数是:<%=readStr%>
</BODY>
</HTML>
HTTP Status 404 - /1.jsp
--------------------------------------------------------------------------------
type Status report
message /1.jsp
description The requested resource (/1.jsp) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.14
<%@ page import="java.io.*"%>
<HTML>
<BODY>
<%
BufferedReader file;
String countFile="countfile.txt";
file=new BufferedReader(new FileReader(countFile));
String readStr=null;
int writeStr=1;
try
{
readStr=file.readLine();
}
catch(IOException e)
{
System.out.println("数据读取错误!");
}
if(readStr==null)
readStr="没有任何纪录。";
else
{
writeStr=Integer.parseInt(readStr)+1;
}
try
{
PrintWriter pw;
pw=new PrintWriter(new FileOutputStream(countFile));
pw.println(writeStr);
pw.close();
}
catch(IOException e)
{
out.println(e.getMessage());
}
%>
这个数是:<%=readStr%>
</BODY>
</HTML>
HTTP Status 404 - /1.jsp
--------------------------------------------------------------------------------
type Status report
message /1.jsp
description The requested resource (/1.jsp) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/5.5.14