2个回答
展开全部
1234567891011121314151617181920212223242526session写的简单计数器---摘自互联网<%@ page errorPage="errorpage.jsp" %><html><head><title>UseSession</title></head><body><%// Try and get the current count from the sessionInteger count = (Integer)session.getAttribute("COUNT");// If COUNT is not found, create it and add it to the sessionif ( count == null ) {count = new Integer(1);session.setAttribute("COUNT", count);}else {count = new Integer(count.intValue() + 1);session.setAttribute("COUNT", count);} // Get the User's Name from the requestout.println("<b>Hello you have visited this site: "+ count + " times.</b>");%></body></html>
展开全部
session写的简单计数器
---摘自互联网
<%@ page errorPage="errorpage.jsp" %>
<html>
<head>
<title>UseSession</title>
</head>
<body>
<%
// Try and get the current count from the session
Integer count = (Integer)session.getAttribute("COUNT");
// If COUNT is not found, create it and add it to the session
if ( count == null ) {
count = new Integer(1);
session.setAttribute("COUNT", count);
}
else {
count = new Integer(count.intValue() + 1);
session.setAttribute("COUNT", count);
}
// Get the User's Name from the request
out.println("<b>Hello you have visited this site: "
+ count + " times.</b>");
%>
</body>
</html>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询