<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.io.*" %>
<HTML>
<BODY>
    <%! int number=0;     
     synchronized void countPeople()
        { 
          if(number==0)
             { 
               try{File f=new File("countPeople.txt"); 
                  FileInputStream in=new FileInputStream(f);
                  DataInputStream dataIn=new DataInputStream(in);
                  number=dataIn.readInt();
                  number++;
                  in.close();dataIn.close();
                 }
                  catch(FileNotFoundException e)
                   { number++;
                    try {File f=new File("countPeople.txt");
                        FileOutputStream out=new FileOutputStream(f);
                        DataOutputStream dataOut=new DataOutputStream(out);
                        dataOut.writeInt(number);
                        out.close();dataOut.close();
                       }
                     catch(IOException ee){}
                  }
                 catch(IOException ee)
                     {
                     }
             }
          else
             {number++;
             try{File f=new File("countPeople.txt");
                FileOutputStream out=new FileOutputStream(f);
                DataOutputStream dataOut=new DataOutputStream(out);
                dataOut.writeInt(number);
                out.close();dataOut.close();
               }
             catch(FileNotFoundException e){}
             catch(IOException e){}
          }
            
     }
   %>
   <%
      if(session.isNew())  //检查session
       {countPeople();
       }
      String str=String.valueOf(number);
         session.setAttribute("count",str);
    %>
<P>您是第<%=(String)session.getAttribute("count")%>个访问本站的人。
<BODY>
<HTML>
