<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*" errorPage="" %> <html> <head> <title>JSP练习</title> </head> <%! int count = 0; //当一个线程调用时,另外的线程需要等待 synchronized void setCount(){ count++; } %> <body bgcolor="yellow"> <% setCount(); out.println("您是第" + count + "个访问本站的客户"); %> </body> </html>
时间: 2024-11-17 22:09:10