<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="GB18030">
<title>Insert title here</title>
</head>
<body>
<%
int i = 0;
synchronized (application) {
if (application.getAttribute("times") == null) {
i = 1;
} else {
i = Integer.parseInt((String) application.getAttribute("times"));
}
application.setAttribute("time", Integer.toString(i));
}
%>
<table>
<tr bgcolor="lightgrey">
<td align="center">欢迎访问</td>
</tr>
<tr>
<td>您是第<%=i %>位访问本网站的游客</td>
</tr>
</table>
</body>
</html>
JSP:通过Application实现网站访问计数器
猜你喜欢
转载自blog.csdn.net/qq_42192693/article/details/81810864
今日推荐
周排行