我想统计有多少人访问了我的网站。应该如何统计呢
我记得是在SESSION里面写个公共变量什么的
具体怎么写啊?谢谢
监 听
application里面记录点击次数啊, 然后写入数据库.
application
<%@ page contentType="text/html;charset=gb2312" language="java"%> <%! synchronized void countPeople() { ServletContext application=getServletContext(); Integer number=(Integer)application.getAttribute("Count"); if(number==null){ number=new Integer(1); application.setAttribute("Count",number); }else{ number=new Integer(number.intValue()+1); application.setAttribute("Count",number); }} %> <% if(session.isNew()) {countPeople(); Integer myNumber=(Integer)application.getAttribute("Count"); session.setAttribute("MyCount",myNumber); } %><h3 align="center">您是第<font color="red"><% int a; if(session.getAttribute("MyCount")!=null) {a=((Integer)session.getAttribute("MyCount")).intValue();} else {a=1;} %><%=a %></font>个访问本站的客户。</h3>
LZ想要怎么统计?是不是想把在线人数显示在页面上?还是想分析数据?
<%@ page contentType="text/html;charset=gb2312" language="java"%> <%! synchronized void countPeople() { ServletContext application=getServletContext(); Integer number=(Integer)applica……up!!!
使用Application就可以
session监听
application登录了就加1
<%@ page contentType="text/html;charset=gb2312" language="java"%> <%! synchronized void countPeople() { ServletContext application=getServletContext(); Integer number=(Integer)applica……登录了就加1 session 就够了
统计Cookie 的id也行啊
可以交给第三方的流量统计厂商google的是免费的,在你的首页嵌入它提供的一段js脚本即可,登录google的统计分析站点可以看到你的网站的详细流量信息,很方便
统计Cookie 的id也行啊同意楼上,用application大家认为可行吗?
可以交给第三方的流量统计厂商google的是免费的,在你的首页嵌入它提供的一段js脚本即可,登录google的统计分析站点可以看到你的网站的详细流量信息,很方便搞错了,楼上说的很对,楼主看看吧!
评论功能因故关闭!
请加入我们的QQ群一起参与讨论:群号59400482(500人超级群)
Copyright © 2007-2010 www.Chengxy.com All rights reserved
Powered by 王牌程序员
监 听
application里面记录点击次数啊, 然后写入数据库.
application
<%@ page contentType="text/html;charset=gb2312" language="java"%> <%! synchronized void countPeople() { ServletContext application=getServletContext(); Integer number=(Integer)application.getAttribute("Count"); if(number==null){ number=new Integer(1); application.setAttribute("Count",number); }else{ number=new Integer(number.intValue()+1); application.setAttribute("Count",number); }} %> <% if(session.isNew()) {countPeople(); Integer myNumber=(Integer)application.getAttribute("Count"); session.setAttribute("MyCount",myNumber); } %><h3 align="center">您是第<font color="red"><% int a; if(session.getAttribute("MyCount")!=null) {a=((Integer)session.getAttribute("MyCount")).intValue();} else {a=1;} %><%=a %></font>个访问本站的客户。</h3>
LZ想要怎么统计?是不是想把在线人数显示在页面上?还是想分析数据?
application
<%@ page contentType="text/html;charset=gb2312" language="java"%> <%! synchronized void countPeople() { ServletContext application=getServletContext(); Integer number=(Integer)applica……up!!!
使用Application就可以
session监听
application登录了就加1
<%@ page contentType="text/html;charset=gb2312" language="java"%> <%! synchronized void countPeople() { ServletContext application=getServletContext(); Integer number=(Integer)applica……登录了就加1 session 就够了
application
统计Cookie 的id也行啊
可以交给第三方的流量统计厂商google的是免费的,在你的首页嵌入它提供的一段js脚本即可,登录google的统计分析站点可以看到你的网站的详细流量信息,很方便
统计Cookie 的id也行啊同意楼上,用application大家认为可行吗?
可以交给第三方的流量统计厂商google的是免费的,在你的首页嵌入它提供的一段js脚本即可,登录google的统计分析站点可以看到你的网站的详细流量信息,很方便搞错了,楼上说的很对,楼主看看吧!