`
lpm528
  • 浏览: 81346 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

统计访问次数的简易方法

    博客分类:
  • JSP
阅读更多
public class Count
{
	private int count;

	public int getCount()
	{
		return ++count;
	}

	public void setCount(int count)
	{
		this.count = count;
	}
	
	

}

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ page language="java" contentType="text/html; charset=GBK"
    pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>    
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>计数器</title>
</head>
<body>
  <jsp:useBean id="count" class="com.chinasoft.zy.Count" scope="session"></jsp:useBean>
  <jsp:useBean id="count2" class="com.chinasoft.zy.Count" scope="application"></jsp:useBean>

  您的访问次数:<jsp:getProperty name="count" property="count"/><br>
  
  总共的访问次数:<jsp:getProperty name="count2" property="count"/>


</body>
</html>

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics