%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8" import="java.util.Enumeration" %>
application属性变化监听器测试
application属性变化监听器测试
<%
application.setAttribute("姓名", "杜老师");
application.setAttribute("姓名", "杜兆将老师");
application.setAttribute("年龄", 52);
out.println("属性名和属性值
");
Enumeration enema=application.getAttributeNames();
while(enema.hasMoreElements()){
String name=(String)enema.nextElement();
String value=application.getAttribute(name).toString();
out.println(""+name+"="+value+"
");
}
out.println("参数名和参数值
");
enema=application.getInitParameterNames();
while(enema.hasMoreElements()){
String name=(String)enema.nextElement();
String value=application.getInitParameter(name);
out.println(""+name+"="+value+"
");
}
application.removeAttribute("姓名");
application.removeAttribute("年龄");
%>