主题:[原创]为什么老提示有错 请大家帮下忙
<%@ page contentType="text/html;charset=GB2312" %>
<html>
<head>
<title>访问计数器</title>
</head>
<body bgcolor="#FFFFFF">
<%@ page import="java.io.*" %>
<%
BufferedReader file;
String countFile="count.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{
PrintWrite pw;
pw = new PrintWrite(new FileOutputStream(countFile));
pw.println(writeStr);
pw.close();
}
catch(IOException e)
{out.println(e.getMessage());}
%>
<p align="center"></p>
<h1>访问计数器</h1>
<h2>你是本网页的第
<font color="#FF0000" size="7">
<%=readStr%>
</font>名访客!</h2>
</body>
</html>
<html>
<head>
<title>访问计数器</title>
</head>
<body bgcolor="#FFFFFF">
<%@ page import="java.io.*" %>
<%
BufferedReader file;
String countFile="count.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{
PrintWrite pw;
pw = new PrintWrite(new FileOutputStream(countFile));
pw.println(writeStr);
pw.close();
}
catch(IOException e)
{out.println(e.getMessage());}
%>
<p align="center"></p>
<h1>访问计数器</h1>
<h2>你是本网页的第
<font color="#FF0000" size="7">
<%=readStr%>
</font>名访客!</h2>
</body>
</html>