页面访问统计
来源:互联网 发布:淘宝网外贸男装 编辑:程序博客网 时间:2024/05/01 13:51
ex2_1.jsp
<%@ page contentType="text/html;charset=gb2312"%>
<HTML><BODY bgcolor=#33ccff>
<%!int i=0;%>
<%
i++;
%>
<p>you are the <%=i%> user visited the page.
</BODY></HTML>
ex2_2.jsp
<%@ pagecontentType="text/html;charset=gb2312"%>
<HTML><BODY >
<%!int number=0;
synchronized void countPeople()
{
number++;}
%>
<%
countPeople();
%>
<p>you are the <%=number%> user visited thepage.
</BODY></HTML>
重点:利用输入输出流
ex2_2.jsp
<%@ pagecontentType="text/html;charset=gb2312"%>
<%@ page import="java.io.*"%>
<HTML>
<BODY>
<%!int number = 0;
File file = new File("count.txt");
synchronized void countPeople() {
if (!file.exists()) {
number++;
try {
file.createNewFile();
FileOutputStream out = newFileOutputStream("count.txt");
DataOutputStream dateOut = new DataOutputStream(out);
dateOut.writeInt(number);
out.close();
dateOut.close();
} catch (IOException ee) {
}
} else {
try {
FileInputStream in = newFileInputStream("count.txt");
DataInputStream dataIn = new DataInputStream(in);
number = dataIn.readInt();
number++;
in.close();
dataIn.close();
FileOutputStream out = newFileOutputStream("count.txt");
DataOutputStream dataOut = new DataOutputStream(out);
dataOut.writeInt(number);
out.close();
dataOut.close();
} catch (IOException ee) {
}
}
}%>
<%
countPeople();
%>
<p>
you are the
<%=number%>
user visited the page.
</BODY>
</HTML>
- 页面访问统计
- 实现页面访问次数统计
- js统计页面访问次数
- 页面访问数据统计[初步]
- struts2统计访问页面人数
- localstorage统计访问页面次数
- 今,昨,周,月 页面访问统计
- 访问统计(浏览过的页面)
- 页面访问统计 提取url中的关键字
- 页面统计数据库表建立访问
- 使用MySQL统计页面访问及排名
- Struts2统计用户访问页面次数
- html页面静态页面实现统计访问人数实例代码
- 访问统计(浏览过的页面)[数据库设计]
- php统计静态html页面浏览访问次数代码
- PHP+MYSQL 如何准确实现页面访问统计次数
- php实现静态页面的访问次数统计
- 利用JS跨域做一个简单的页面访问统计系统
- HttpClient 部署
- jsp上传文件(简单)
- xbmc小结
- PushButton引擎学习笔记1
- ARGB8888 --> ARGB4444&Other Formats 收藏
- 页面访问统计
- 简单的问题
- Attribute在.net编程中的应用(二)
- eclipse注释日期格式修改
- 一个关于struts2技术的链接
- 抽象类与接口的区别
- MyEclipse6.0快捷键
- 使用DataSet对象添加记录
- 快速更新上十万数据的SQL