zoukankan      html  css  js  c++  java
  • Jsp application对象(全局变量)

    常用方法:

    <%@ page import="java.util.Enumeration" %><%--
      Created by IntelliJ IDEA.
      User: Administrator
      Date: 2020/2/13
      Time: 21:19
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>application对象</title>
    </head>
    <body>
        <p>application内置对象</p>
        <hr>
        <%
            application.setAttribute("city", "太原");
            application.setAttribute("postcode", "1000");
            application.setAttribute("email", "1234@163.com");
        %>
        所在城市是:<%=application.getAttribute("city")%><br>
        application中的属性有:<%
            Enumeration attributes = application.getAttributeNames();   //枚举
            while (attributes.hasMoreElements()){
                out.println(attributes.nextElement()+"&nbsp;&nbsp");
            }
        %><br>
        jsp(servlet)引擎名及版本号:<%=application.getServerInfo()%><br>
    
    </body>
    </html>
    View Code

    结果:

  • 相关阅读:
    C库函数中字符串处理函数集合(转)
    浅谈C++底层机制
    vc2008快捷键
    Delphi格式输出的用法
    Devenv 命令行开关
    DX皮肤控制
    C#格式化
    linq查询DataView
    WCF中的session用法
    VS2012clickonce发布问题
  • 原文地址:https://www.cnblogs.com/CPU-Easy/p/12305371.html
Copyright © 2011-2022 走看看