首页 > 其他 > 详细

ServletContext保存访问量

时间:2015-10-13 21:02:00      阅读:308      评论:0      收藏:0      [点我收藏+]

ServletContext application  = this.getServletContext(); 

       Integer count = (Integer)application.getAttribute("count");

       if(count == null) {

           count = 1;

       } else {

           count++;

       }

       response.setContentType("text/html;charset=utf-8");

       response.getWriter().print("<h1>本页面一共被访问" + count + "次!</h1>");

       application.setAttribute("count", count);

ServletContext保存访问量

原文:http://www.cnblogs.com/ab10/p/4875630.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!