countv2.jsp

来自「石志国著《JSP应用教程》」· JSP 代码 · 共 32 行

JSP
32
字号
<%@ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY>
<%!
	String G(Integer counter)
	{
	   String S, myimage;
       myimage = "";
	   S = counter.toString() ;

	   for(int i = 0; i<S.length(); i++)
	   {
		  myimage = myimage + "<IMG SRC=" + S.charAt(i) + ".gif>";
	   }
	   return myimage;
	}
%>
<%
	Integer number=(Integer)application.getAttribute("Count");
	if(number==null)	{ 
		number=new Integer(1);
		application.setAttribute("Count",number); 
	}
	else   { 
		number=new Integer(number.intValue() + 1);
		application.setAttribute("Count",number); 
	}
	%>
您是第<%=G((Integer)application.getAttribute("Count"))%>
个访问本站的客户。
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?