不知道怎么改这个程序,大虾帮忙
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%!
synchronized void countPeople()
{
ServletContext application =getServletContext();
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);
}
}
%>
<%! Integer yourNumber= new Integer(0);
if( session.isNew()){
countPeople();
yourNumber = (Integer)application.getAttribute("Count");
}
%>
<P><P>欢迎你:你是第
<% =yourNumber %>
位来客
</body>
</html>
----------------解决方案--------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JSP Page</title>
</head>
<body>
<%
ServletContext app =getServletContext();
Integer number= (Integer)app.getAttribute("Count");
if(number==null){
number=new Integer(1);
application.setAttribute("Count",number);
}
else
{
number= new Integer(number.intValue()+1);
application.setAttribute("Count",number);
}
%>
<P><P>欢迎你:你是第<%=((Integer)app.getAttribute("Count")).intValue()%> 位来客
</body>
</html>
[此贴子已经被作者于2007-11-17 11:18:12编辑过]
----------------解决方案--------------------------------------------------------