<%
Integer hitsCount =
(Integer)application.getAttribute("hitCounter");
if( hitsCount ==null || hitsCount == 0 ){
/* 第一次访问 */
out.println("欢迎访问菜鸟教程!");
hitsCount = 1;
}else{
/* 返回访问值 */
out.println("欢迎再次访问菜鸟教程!");
hitsCount += 1;
}
application.setAttribute("hitCounter", hitsCount);
%>
页面访问量为: <%= hitsCount%>