结合数据库或者写文件的方式,自己写一个啊

解决方案 »

  1.   

    <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>