application在整个WEB项目中共享使用数据。

常用方法:
 getAttribute();
 setAttribute();
示列:

<%
    Object count=application.getAttribute("count");
    if(count==null){
     //application中未存放count
     application.setAttribute("count", new Integer(1));
    }else{
     //application中已经存放count
     Integer i=(Integer)count;
     application.setAttribute("count", i.intValue()+1);
    }
    Integer icount=(Integer)application.getAttribute("count");
    out.println("页面被访问了"+icount.intValue()+"次");
    %>

可以直接将此段代码放在需要显示的JSP页面中。

最新文章

  1. Windows下MySQL的常用操作
  2. C代码实现数组
  3. 关于安卓APP的启动界面
  4. Unity学习疑问记录之脚本生命周期
  5. Spring @Service生成bean名称的规则
  6. HBase(八): 表结构设计优化
  7. bzoj 3920: Yuuna的礼物
  8. Hex-Rays decompiler type definitions and convenience macros
  9. main方法无法编译
  10. Android EditText中插入图片并响应点击事件
  11. C期未考试参考答案题1
  12. [LeetCode]题解(python):022-Generate Parentheses
  13. C++构造 下一个排列 的函数
  14. All is Over
  15. Windows Server 2008系统
  16. 简明的Python教程当中的几个疑惑点分析#1
  17. stage.focus后 有黄色边框怎么去掉
  18. 使用Hystrix实现自动降级与依赖隔离-微服务
  19. 接口与协议学习笔记-Ethernet UDP通信协议(一)
  20. react native项目直接全局定义横竖屏幕

热门文章

  1. div+css显示两行或三行文字
  2. 前端工作准备-foxmail登陆失败汇总
  3. ASP.NET MVC 基于表达式的动态查询
  4. 清除苹果手机input的默认样式
  5. (转)CSS布局-负边距-margin
  6. python调用Go代码
  7. 在tomcat6.5+上配置虚拟主机
  8. 【总结整理】webGIS学习thinkGIS(四)WebGIS中通过行列号来换算出多种瓦片的URL 之离线地
  9. JSP页面使用EL表达式出现的问题:javax.el.PropertyNotFoundException: Property &#39;ID&#39; not found on type java.lang.Str
  10. SQL CLR学习