1.一次会话算一次访问。 % ! int i = 0 ; % % if (session.isNew()){ i ++ ; } % p 访问方式:一次会话算一次访问。 nbsp;nbsp;nbsp;nbsp; 当前浏览量: % = i % / p 2.刷新一次网页增加一次浏览量: % Integer
1.一次会话算一次访问。
<%! int i = 0;%> <% if(session.isNew()){ i++; } %> <p>访问方式:一次会话算一次访问。 当前浏览量:<%=i %></p>
2.刷新一次网页增加一次浏览量:
<% Integer count=(Integer)application.getAttribute("count"); if(count==null){ count=1; } application.setAttribute("count", count+1); %> <p>访问方式:刷新一次网页算一次访问。 当前浏览量:<%=count %></p>