记录网页刷新次数

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<%
  Object object = application.getAttribute("count");
  int count = 0;
  if (null == object) {
	  count  = 1;
	  application.setAttribute("count", count);
  } else {
	  count = (Integer) object;
	  count++;
	  application.setAttribute("count", count);
  }
%>
<body>
<h1><%=count%></h1>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/footprint01/article/details/82971729