0
点赞
收藏
分享

微信扫一扫

application 对于网页计数器的使用(关键代码)

陌岛 2022-07-12 阅读 57


<!-- 统计页面被访问次数 -->
<%
      Object count=application.getAttribute("count");
      if(count==null){
          application.setAttribute("count",new Integer(1));
       }else{
          Integer i=(Integer)count;
          application.setAttribute("count",i.intValue()+1);
       }   
        Integer icount=(Integer)application.getAttribute("count");
        out.print("页面被访问了 "+icount.intValue()+"次");      
 %>

举报

相关推荐

0 条评论