zoukankan      html  css  js  c++  java
  • 每日博客

    application对象实现网站计数器

     <%
     Object oCount = application.getAttribute("count");   //取得count属性值,如果还没有改属性则返回null;
     Integer count=null;
     if(oCount==null){
      count = new Integer(1);   //新建一个Integer对象,因为这是首个访问者,所以包含值1
      application.setAttribute("count", count);  //为application对象增加count属性并制定其值;
     }else{
      count = (Integer)application.getAttribute("count");
      count = new Integer(count.intValue()+1);  //将count对象包含的值增加1
      application.setAttribute("count", count); //把增加后的新count对象赋值到application对象的count属性
     }
     %>
     <br>
    <font color="red"><%=count.intValue() %></font>
  • 相关阅读:
    C语言内存分析
    算法之快速排序
    单链表逆转
    C程序设计语言之一
    vim插件配置(一)
    makefile示例
    cocos2d基础入门
    Makefile
    Makefile
    GCC编译四阶段
  • 原文地址:https://www.cnblogs.com/hfy717/p/14901168.html
Copyright © 2011-2022 走看看