运行后报错啊:
type Status reportmessage count.txt (系统找不到指定的文件。)description The requested resource (count.txt (系统找不到指定的文件。)) is not available.--------------------------------------------------------------------------------
type Status reportmessage count.txt (系统找不到指定的文件。)description The requested resource (count.txt (系统找不到指定的文件。)) is not available.--------------------------------------------------------------------------------
f1.createNewFile();生成一个
还是报错。
if(!f1.exists())f1.createNewFile();
红猩猩都说了
<html>
<body>
<%@ page import="java.io.*"%>
<%
BufferedReader file;
String countFile="c:\\count.txt";
String readStr=null;
int writeStr=1;
try
{
file=new BufferedReader(new FileReader(countFile));
readStr=file.readLine();
}catch(IOException e)
{
System.out.println("read data error");
}
if(readStr==null) readStr="no data";
else
{
writeStr=Integer.parseInt(readStr)+1;
}try{
PrintWriter pw;
pw=new PrintWriter(new FileOutputStream(countFile));
pw.println(writeStr);
pw.close();
} catch(IOException e)
{
System.out.println(e.getMessage());
}
%>
<h1> you are the </h1>
<h3> <%=readStr%></h3>
<h1> vistor to the page</h1>
</body>
</html>