首页后端开发其他后端知识jsp计数器代码

jsp计数器代码

时间2024-02-07 19:29:03发布访客分类其他后端知识浏览241
导读:收集整理的这篇文章主要介绍了jsp计数器代码,觉得挺不错的,现在分享给大家,也给大家做个参考。 <!-- JSP-HITcounter counts sessions.Copyri...
收集整理的这篇文章主要介绍了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实现计数器基础方法

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: jsp计数器代码
本文地址: https://pptw.com/jishu/604461.html
IBM WebSphere源代码暴露漏洞 Sun认为C#不会替代Java

游客 回复需填写必要信息