我的代码:
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="KEYWORDS" content="这是一个虚拟的JSP小站主页,作为小龙亭JSP实践之旅的一部分。">
<title>每日的文学阳光</title>
<link rel=stylesheet href="style.css" type="text/css">
</head>
<body>
<%@ include file="top.htm" %>
<p>&nbsp;</p>
<%@ page import="java.io.*" %><% 
String currentRecord = null;//保存文本的变量
BufferedReader file; //BufferedReader对象,用于读取文件数据
String nameOfTextFile = "count.txt";
//读取
file = new BufferedReader(new FileReader(nameOfTextFile));
String readStr =null;
int writeStr =0;   //如果数据库为空则让它显示时变成1并写入
try
{ readStr = file.readLine(); }
catch (IOException e)
{ System.out.println("读取数据错误."); }
if (readStr == null) readStr = "没有任何记录";
//加1
else { writeStr = Integer.parseInt(readStr)+1;}//写入
try { 
PrintWriter pw = new PrintWriter(new FileOutputStream(nameOfTextFile));
pw.println(writeStr);
pw.close();}catch(IOException e) {
out.println(e.getMessage());
}
%>
<p align="center">您是小龙亭第<b><font color="red"><%=writeStr%></font></b>位客人。请选择:</p>
<br><br>
<center>
<table width="70%">
<tr>
<td align="center" width="20%"><a href="login.jsp">登录</a></td>
<td align="center" width="20%"><a href="register.jsp">注册</a></td>
<td align="center" width="20%"><a href="shade.jsp">留言</a></td>
<td align="center" width="20%"><a href="appriciate.jsp">文学欣赏</a></td>
<td align="center" width="20%"><a href="forum.jsp">风景论坛</a></td>
</tr>
</table>
</center>
<p>&nbsp;</p>
<%@ include file="bottom.htm" %>
</body>
</html>

解决方案 »

  1.   

    HTTP Status 404 - count.txt (系统找不到指定的文件。)
    The requested resource (count.txt (系统找不到指定的文件。)) is not available.
      

  2.   

    readStr = file.readLine(); ????????
    是不是应该按数据包读取?
      

  3.   

    我觉得我的CLASSPATH射的没问题,可他就说找不到COUNT。TXT,还有其他的BEANS也找不到。
    同志们是不是觉得分不够啊,http://expert.csdn.net/Expert/topic/1327/1327815.xml?temp=2.540225E-02,这个也算上,同个问题嘛,大家讨论一下,搞定后,40分!呵呵!
      

  4.   

    你的count.txt目录在什么地方?
      

  5.   

    我的路径是wabapps\ROOT\test,
    我把*.jsp 和count.txt都放在了test下,还有所有的BEANS都放在了test\WEB-INF\classes下,运行的时候也找不到beans,还有count.txt也找不到.我的classpath是这样的:
    e:\jdk1.3\lib\tools.jar;e:\jdk1.3\lib\dt.jar; 
    系统变量:d:\Tomcat;e:\jdk1.3\bin
      

  6.   

    <jsp:useBean id="utilBean" scope="page" class="Utility" />
    <jsp:useBean id="forumBean" scope="page" class="mydb" />