<%@ page language="java" contentType="text/html; charset=GB2312"%>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
<form name="form1">
<%! synchronized void countPeople(){
ServletContext application=getServletContext();
Integer number=(Integer)application.getAttribute("count");
if(number==null) {
number=new Integer(1);
application.setAttribute("count",number);
}else{
number=new Integer(number.intValue()+1);
application.setAttribute("count",number);
}
}
%>
<%String yourName = (String) session.getAttribute("LogName");
%>
<% if(session.isNew())//判断session是不是一个新建的对象。
{countPeople();}
%>
<% Integer t=((Integer)application.getAttribute("count")).intValue();%>
<P> <%=yourName %>,欢迎您登录!您是第<%=t%>个访问本站的客户。
</P></form>
</body>
</html>