⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0157.htm

📁 精通struts源码,孙卫琴.经过更新后的,请查收,
💻 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>&lt;!--&nbsp; <br>
JSP-Hitcounter&nbsp; counts&nbsp; sessions.<br>
Copyright&nbsp; (C)&nbsp; 2000&nbsp; Jesper&nbsp; Schmitz&nbsp; Mouridsen.&nbsp; <br>
Visit&nbsp; www.webappcabaret/jsm2/webapps.jsp?find=jsphcs&nbsp; for&nbsp; more&nbsp; info.&nbsp; <br>
<br>
This&nbsp; program&nbsp; is&nbsp; free&nbsp; software;&nbsp; you&nbsp; can&nbsp; redistribute&nbsp; it&nbsp; and/or&nbsp; modify&nbsp; it&nbsp; under&nbsp; the&nbsp; terms&nbsp; of&nbsp; the&nbsp; GNU&nbsp; General&nbsp; Public&nbsp; License&nbsp; as&nbsp; published&nbsp; by&nbsp; the&nbsp; Free&nbsp; Software&nbsp; Foundation;&nbsp; either&nbsp; version&nbsp; 2&nbsp; of&nbsp; the&nbsp; License,&nbsp; or&nbsp; (at&nbsp; your&nbsp; option)&nbsp; any&nbsp; later&nbsp; version.&nbsp; <br>
<br>
This&nbsp; program&nbsp; is&nbsp; distributed&nbsp; in&nbsp; the&nbsp; hope&nbsp; that&nbsp; it&nbsp; will&nbsp; be&nbsp; useful,&nbsp; but&nbsp; WITHOUT&nbsp; ANY&nbsp; WARRANTY;&nbsp; without&nbsp; even&nbsp; the&nbsp; implied&nbsp; warranty&nbsp; of&nbsp; MERCHANTABILITY&nbsp; or&nbsp; FITNESS&nbsp; FOR&nbsp; A&nbsp; PARTICULAR&nbsp; PURPOSE.&nbsp; See&nbsp; the&nbsp; GNU&nbsp; General&nbsp; Public&nbsp; License&nbsp; at&nbsp; http://www.opensource.org/licenses/gpl-license.html&nbsp; for&nbsp; more&nbsp; details&nbsp; <br>
--><br>
<br>
<br>
&lt;%&nbsp; <br>
<br>
BufferedReader&nbsp; inf&nbsp; =&nbsp; new&nbsp; BufferedReader(new&nbsp; FileReader("/path/to/counter.txt"));<br>
int&nbsp; tmp&nbsp; =&nbsp; Integer.parseInt(inf.readLine());<br>
int&nbsp; i=0;<br>
<br>
try&nbsp; {<br>
<br>
i&nbsp; =&nbsp; Integer.parseInt(request.getSession().getValue("tal").toString());<br>
}&nbsp; catch&nbsp; (NullPointerException&nbsp; t)&nbsp; {i=0;&nbsp; }<br>
<br>
if&nbsp; (i==0)&nbsp; {<br>
tmp++;<br>
<br>
PrintWriter&nbsp; outf&nbsp; =&nbsp; new&nbsp; PrintWriter(new&nbsp; BufferedWriter(new&nbsp; FileWriter("/path/to/counter.txt")));<br>
outf.println(tmp);<br>
outf.close();<br>
inf.close();<br>
request.getSession().putValue("tal",&nbsp; "1");<br>
}<br>
<br>
BufferedReader&nbsp; inf2&nbsp; =&nbsp; new&nbsp; BufferedReader(new&nbsp; FileReader("/path/to/counter.txt"));<br>
%><br>
&lt;%<br>
String&nbsp; zeroes="";<br>
String&nbsp; hits&nbsp; =&nbsp; inf2.readLine();<br>
inf2.close();<br>
for&nbsp; (int&nbsp; t=0;&nbsp; t&nbsp; &lt;&nbsp; 8-hits.length();&nbsp; t++)&nbsp; {<br>
zeroes=zeroes+"0";&nbsp; }<br>
out.println(zeroes&nbsp; +&nbsp; hits);<br>
%>

  </table>
<p align="center"><script src="../../2.js"></script></a>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -