作用域范围
作用域
getAttribute(),setAttribute()
- page 页面级,基本不用
- request 一次请求
- session 一次会话
- application 整个web应用
示例
网站访问计数
<%
Integer count = (Integer) application.getAttribute("count");
if(count == null){
count = 1;
application.setAttribute("count",count);
}else{
count++;
application.setAttribute("count",count);
}
%>

浙公网安备 33010602011771号