首 页 | 精品电影 | 音乐天堂 | 在线游戏 | Flash MTV | 三湘书屋 | 幽默笑话 | 三湘图库 | 美女写真 | IT知识库 | QQ贴图 | 加入书签

网页制作网络编程图形图象操作系统冲浪宝典软件教学网络安全认证考试通信技术电子商务业内动态书籍教程原码

最近更新 文章分类 多媒体类 精品软件

本站搜索:
您的位置:三湘时空 -> IT知识库 -> 文章分类 -> JSP实例 -> jsp计数器代码  
jsp计数器代码


文章类别:JSP实例 来源: 作者: 发表日期:2005-10-3 字体:[ ]

小游戏 | 在线影院 | 幽默笑话 | 源码下载 | Flash MTV | 音乐试听 | 书屋 | 美女写真

<!--
JSP-Hitcounter counts sessions.
Copyright (C) 2000 Jesper Schmitz Mouridsen.
Visit www.webappcabaret/jsm2/webapps.jsp?find=jsphcs for more info.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License at http://www.opensource.org/licenses/gpl-license.html for more details
-->


<%

BufferedReader inf = new BufferedReader(new FileReader("/path/to/counter.txt"));
int tmp = Integer.parseInt(inf.readLine());
int i=0;

try {

i = Integer.parseInt(request.getSession().getValue("tal").toString());
} catch (NullPointerException t) {i=0; }

if (i==0) {
tmp++;

PrintWriter outf = new PrintWriter(new BufferedWriter(new FileWriter("/path/to/counter.txt")));
outf.println(tmp);
outf.close();
inf.close();
request.getSession().putValue("tal", "1");
}

BufferedReader inf2 = new BufferedReader(new FileReader("/path/to/counter.txt"));
%>
<%
String zeroes="";
String hits = inf2.readLine();
inf2.close();
for (int t=0; t < 8-hits.length(); t++) {
zeroes=zeroes+"0"; }
out.println(zeroes + hits);
%>

上一篇:jsp源码实例1(输出) 下一篇:jsp源码实例2(获取表单参数)
本栏目热门文章
·jspSmartUpload上传下载全攻略 2005-10-4
·JSP的login程序代码 2005-10-4
·JSP/Servlet构建三层管理信息系统 2005-10-4
·JSP与SQL SERVER的留言本 2005-10-4
·JSP数据库操作例程(Use Bean) 2005-10-4
·JSP+XML构架网站的实例 2005-10-4
·jsp+javascript打造级连菜单 2005-10-4
·利用iText在JSP中生成PDF报表 2005-10-4
·jsp留言板源代码一: 给jsp初学者. 2005-10-3
·jsp留言板源代码二: 给jsp初学者. 2005-10-3
新近更新文章
·JSP/Servlet构建三层管理信息系统 2005-10-4
·jsp+javascript打造级连菜单 2005-10-4
·JSP单页面网站文件管理器 2005-10-4
·JSP调用JavaBean在网页上动态生成柱状图 2005-10-4
·Tomcat5.x中的虚拟主机配置方法 2005-10-4
·利用iText在JSP中生成PDF报表 2005-10-4
·JSP与SQL SERVER的留言本 2005-10-4
·jspSmartUpload上传下载全攻略 2005-10-4
·轻松使用JSP生成饼图 2005-10-4
·JSP+XML构架网站的实例 2005-10-4
首 页 | 软件发布 | 广告联系 | 下载帮助 | 意见反馈 | 网站地图
  CopyRight? 2002-2004 WWW.SXSKY.NET? All Rights Reserved
三湘时空 站长QQ:82675303 Email: