• 吴裕雄--天生自然JAVA开发JSP-Servlet学习笔记:让多个JSP、Servelet共享数据


    <%-- 
        Document   : put-application
        Created on : 2020-4-11, 19:51:55
        Author     : Administrator
    --%>
    
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
        <head>
            <title>application测试</title>
            <meta name="website" content="http://www.crazyit.org" />
        </head>
        <body>
            <!-- JSP声明 -->
            <%!
                int i=0;
            %>
            <!-- 将i值自加后放入application的变量内 -->
            <%
                application.setAttribute("counter", String.valueOf(++i));
            %>
            <!-- 输出i值 -->
            <%=i%>
        </body>
    </html>

    <%-- 
        Document   : get-Application
        Created on : 2020-4-11, 19:56:18
        Author     : Administrator
    --%>
    
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
        <head>
            <title>application测试</title>
            <meta name="website" content="http://www.crazyit.org" />
        </head>
        <body>
            <!-- 直接输出application 变量值 -->
            <%=application.getAttribute("counter")%>
        </body>
    </html>

  • 相关阅读:
    BZOJ3439: Kpm的MC密码
    BZOJ2819: Nim
    BZOJ1901: Zju2112 Dynamic Rankings
    Bzoj3230: 相似子串
    Bzoj4504: K个串
    CF609E. Minimum spanning tree for each edge
    bzoj1832: [AHOI2008]聚会
    css 笔记1
    namespace 相关
    cmd 命令
  • 原文地址:https://www.cnblogs.com/tszr/p/12681871.html
Copyright © 2020-2023  润新知