回 帖 发 新 帖 刷新版面

主题:关于文件读写的问题 404异常

<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.io.*"%>
<HTML>
<BODY>
<%
      BufferedReader file;
      String countFile="countfile.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());
      }
%>
这个数是:<%=readStr%> 
</BODY>
</HTML>
HTTP Status 404 - /1.jsp

--------------------------------------------------------------------------------

type Status report

message /1.jsp

description The requested resource (/1.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.14

回复列表 (共1个回复)

沙发

file=new BufferedReader(new InputStreamReader(new FileInputStream(countFile)));
?看看这个行吗


http://www.jspcn.net/htmlnews/11453821960151869.html

我来回复

您尚未登录,请登录后再回复。点此登录或注册