简单的application站点计数器
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>application站点计时器</title>
</head>
<body>
<%
int n = 0;
String count = (String)application.getAttribute("count");
// session.isNew()防止刷新也计数
if(count != null && session.isNew()){
n = Integer.parseInt(count);
}
n = n+1;
out.print("你是第"+ n +"位访客!");
count = String.valueOf(n);
application.setAttribute("count",count);
%>
</body>
</html>