主页 > 知识库 > jsp计数器代码

jsp计数器代码

热门标签:美图手机 网站文章发布 检查注册表项 智能手机 呼叫中心市场需求 铁路电话系统 银行业务 服务器配置
!--
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);
%>

您可能感兴趣的文章:
  • 使用JavaScript制作一个简单的计数器的方法
  • jsp网页计数器实现示例
  • 一个简单的网站访问JS计数器 刷新1次加1次访问
  • javascript下计数器每秒自动加1
  • 用JAVASCRIPT帮我写个计数器
  • js计数器代码
  • jsp计数器制作手册
  • jsp计数器制作
  • 一个可以防止刷新的JSP计数器
  • JavaScript实现计数器基础方法

标签:上海 沈阳 乐山 沧州 长治 新疆 河南 红河

巨人网络通讯声明:本文标题《jsp计数器代码》,本文关键词  ;如发现本文内容存在版权问题,烦请提供相关信息告之我们,我们将及时沟通与处理。本站内容系统采集于网络,涉及言论、版权与本站无关。
  • 相关文章
  • 收缩
    • 微信客服
    • 微信二维码
    • 电话咨询

    • 400-1100-266