服务器启动后就产生了这个application对象,当客户再所访问的网站的各个页面之间浏览时,这个application对象都是同一个,直到服务器关闭。但是与session不同的是,所有客户的application对象都是同一个,即所有客户共享这个内置的application对象。
内容来自dedecms
copyright dedecms
<%@page contentType="text/html;charset=GB2312"%>
<html>
<head> </head>
<body>
<center>
<font size="5">application对象的使用</font> 织梦内容管理系统
<hr/>
<%
Object o = null;
String strNum = (String) application.getAttribute("Num"); //与session相同 织梦好,好织梦
int Num = 0;
if (strNum != null)
Num = Integer.parseInt(strNum) + 1; dedecms.com
application.setAttribute("Num", String.valueOf(Num));
%>
application对象中的
<font color="blue">Num</font> 织梦好,好织梦
变量值为:
<font color="red"><%=Num %> </font>
<br/>
</center>
</body>
</html>
织梦好,好织梦
1. getAttribute( String name )
返回由name指定的名字的application对象的属性的值. 织梦内容管理系统
2. getAttributeNames()
返回所有的application对象的属性的名字,其结果是一个枚举的实例.
3. getInitParameter( String name )
返回由name指定的名字的application对象的某个属性的初始值.
织梦内容管理系统
4. getServletInfo()
返回servlet编译器的版本的信息. 织梦好,好织梦
5. setAttribute( String name , Object object )
设置由name指定的名字的application对象的属性的值object. dedecms.com



