我的代码:
<%@ 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> </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> </p>
<%@ include file="bottom.htm" %>
</body>
</html>
<%@ 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> </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> </p>
<%@ include file="bottom.htm" %>
</body>
</html>
解决方案 »
- 关于Java聊天程序通行问题!!麻烦大家帮忙看看!!拜谢!!!
- Jtable 排序
- 菜鸟问题关于求素数
- 郁闷的环境变量问题
- 请教MS画图中油漆桶的算法
- 这样的线程怎样结束??
- 函数的问题
- 有高手来看看这个EXCEPTION是怎么回事???????
- 运行applet出现的问题。。。java.security.AccessControlException: access denied
- 谁能给我《Java 2 核心技术 卷I:基础知识》的源代码,本人的随书光盘丢了,谢谢了!急
- 请提供jbuilder 8正式版的下载
- 我的第一个程序出错"Can't find main class" ,不知道什么原因?
The requested resource (count.txt (系统找不到指定的文件。)) is not available.
是不是应该按数据包读取?
同志们是不是觉得分不够啊,http://expert.csdn.net/Expert/topic/1327/1327815.xml?temp=2.540225E-02,这个也算上,同个问题嘛,大家讨论一下,搞定后,40分!呵呵!
我把*.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
<jsp:useBean id="forumBean" scope="page" class="mydb" />