JSP tutorial using application statistics online number code
<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%>
<%
String path = Request.getcontextpath ();
String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";
%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"
< Title>application</title>
<body>
<% !
Integer number;//
synchronized void Numbervisiter ()
{
ServletContext application = Getservletcontext ();
Integer num = (integer) application.getattribute ("Count");
if (num = null)//If the first accessor
{
num = new Integer (1);
Application.setattribute ("Count", num);
}
Else
{
num = new Integer (Num.intvalue () + 1);
Application.setattribute ("Count", num);
}
}
%>
<%
if (session.isnew ())
{
numbervisiter ();
&nbs P Integer number = (integer) application.getattribute ("Count");
}
%>
<P>
<font size= "2" color= "Blue" > Simple page Access counter </font>
</p>
<P>
<font size= "2" color= "#000000"
Welcome to this page, you are <%=number%> Access user
</FONT>
</p>
</body>