📄 0157.htm
字号:
<html>
<head>
<title>新时代软件教程:操作系统 主页制作 服务器 设计软件 网络技术 编程语言 文字编辑</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
body, table {font-size: 9pt; font-family: 宋体}
a {text-decoration:none}
a:hover {color: red;text-decoration:underline}
.1 {background-color: rgb(245,245,245)}
-->
</style>
</head>
<p align="center"><script src="../../1.js"></script></a>
<p align="center"><big><strong>jsp计数器代码</strong></big></p>
<div align="right">---摘自互联网</div>
<br><!-- <br>
JSP-Hitcounter counts sessions.<br>
Copyright (C) 2000 Jesper Schmitz Mouridsen. <br>
Visit www.webappcabaret/jsm2/webapps.jsp?find=jsphcs for more info. <br>
<br>
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. <br>
<br>
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 <br>
--><br>
<br>
<br>
<% <br>
<br>
BufferedReader inf = new BufferedReader(new FileReader("/path/to/counter.txt"));<br>
int tmp = Integer.parseInt(inf.readLine());<br>
int i=0;<br>
<br>
try {<br>
<br>
i = Integer.parseInt(request.getSession().getValue("tal").toString());<br>
} catch (NullPointerException t) {i=0; }<br>
<br>
if (i==0) {<br>
tmp++;<br>
<br>
PrintWriter outf = new PrintWriter(new BufferedWriter(new FileWriter("/path/to/counter.txt")));<br>
outf.println(tmp);<br>
outf.close();<br>
inf.close();<br>
request.getSession().putValue("tal", "1");<br>
}<br>
<br>
BufferedReader inf2 = new BufferedReader(new FileReader("/path/to/counter.txt"));<br>
%><br>
<%<br>
String zeroes="";<br>
String hits = inf2.readLine();<br>
inf2.close();<br>
for (int t=0; t < 8-hits.length(); t++) {<br>
zeroes=zeroes+"0"; }<br>
out.println(zeroes + hits);<br>
%>
</table>
<p align="center"><script src="../../2.js"></script></a>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -