该程序实现一个计数器,在此程序中要使用一个文件count.txt我不知道要放这个文件的路径.麻烦高手指点一下.
该程序现在存放得路径为:D:\tomcat\webapps\test
请问count.txt文件应该放在哪里呢?<%@ page language="java" import="java.util.*,java.io.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>文字模式访问记数器</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </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
 {
  PrintWriter pw;
  pw = new PrintWriter(new FileOutputStream(countFile));
  pw.println(writeStr);
  pw.close();
 }
 catch(IOException e){
  out.println(e.getMessage());
 }
 %>
 
 <p align = "center">
 <H1>文字模式访问记数器</H1>
 <H3>你是本网页第
 <font color = "ff0000" size = "7">
 <%=readStr%>
 </font>名访客</H3>
  </body>
</html>