有没有最简单的计数器啊,希望大侠给个 结合数据库或者写文件的方式,自己写一个啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><body><%@ page import="java.io.*"%><% BufferedReader file; String countFile="c:\\count.txt"; String readStr=null; int writeStr=1; try { file=new BufferedReader(new FileReader(countFile)); readStr=file.readLine(); }catch(IOException e) { System.out.println("read data error"); }if(readStr==null) readStr="no data";else { writeStr=Integer.parseInt(readStr)+1; }try{ PrintWriter pw; pw=new PrintWriter(new FileOutputStream(countFile)); pw.println(writeStr); pw.close();} catch(IOException e) { System.out.println(e.getMessage()); } %><h1> you are the </h1><h3> <%=readStr%></h3><h1> vistor to the page</h1></body></html> [求助]HTML Object 元素请求后台数据问题 Javassist动态生成的类 批量修改包名 上海WAP游戏公司招聘 紧急求助!怎样捕获键盘上控制键的输入 为何无法加载驱动程序??? Jsoup 爬不了 iframe 中的内容 我C作了一个简单的ActiveX控件但是,在网页里面怎么也调不了!没用过!大家帮忙看看吧!多谢! 一个登陆程序,调试出错!帮忙 apache和jetty整合session的问题 请问哪位有统计页面流量的计数器呢? 把Map中的string取出来放到数组中会出错!?
<body>
<%@ page import="java.io.*"%>
<%
BufferedReader file;
String countFile="c:\\count.txt";
String readStr=null;
int writeStr=1;
try
{
file=new BufferedReader(new FileReader(countFile));
readStr=file.readLine();
}catch(IOException e)
{
System.out.println("read data error");
}
if(readStr==null) readStr="no data";
else
{
writeStr=Integer.parseInt(readStr)+1;
}try{
PrintWriter pw;
pw=new PrintWriter(new FileOutputStream(countFile));
pw.println(writeStr);
pw.close();
} catch(IOException e)
{
System.out.println(e.getMessage());
}
%>
<h1> you are the </h1>
<h3> <%=readStr%></h3>
<h1> vistor to the page</h1>
</body>
</html>