zoukankan      html  css  js  c++  java
  • Java web ch03_14_applicatin.jsp

    <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>统计网站访问人数及其当前在线人数</title>
    </head>
    <body>
    <%! Integer yourNumber=new Integer(0); %>
    <% if(session.isNew()){ //如果是一个新的会话
    Integer number=(Integer) application.getAttribute("Count");
    if(number == null) //如果是第1个访问网站
    { number = new Integer(1); }
    else
    { number = new Integer(number.intValue()+1);}
    application.setAttribute("Count",number);
    yourNumber = (Integer)application.getAttribute("Count");
    }
    %>
    欢迎访问本站,您是第 <%=yourNumber%>个访问用户。
    </body>
    </html>

    运行

    在浏览器再运行

  • 相关阅读:
    使用IOCP完成端口队列做任务队列
    对Zlib单元进行再封装
    XmlReader/XmlWriter 类
    TextReader/TextWriter 的类
    LINQ to XML
    Xml序列化
    动态Linq(结合反射)
    设计模式总结
    深入了解.Net上下文
    应用程序域
  • 原文地址:https://www.cnblogs.com/meng2/p/7643654.html
Copyright © 2011-2022 走看看