一个简单的聊天室的登陆,有错误
下面是一个简单的聊天室的登陆,为什么我第一个用户登陆完,第二个用户登陆第一个用户却没有记录进去,后面第三个,第四个.......都是好的,是不是初始化的时候哪里错了
<%@page contentType= "text/html "%>
<%@page pageEncoding= "GB2312 "%>
<%@page import= "java.util.Calendar "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN "
"http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=UTF-8 ">
<title> welcome </title>
</head>
<body>
<%! int count=0;
Object talk=null;
int i=1;%>
<%
String iStr=String.valueOf(i);
String countStr=(String)application.getAttribute( "count ");
if (countStr==null)
application.setAttribute( "count ", "1 ");
else {
count+=1;
application.setAttribute( "count ",String.valueOf(count));}
String talkStr=(String)application.getAttribute( "talk ");
if (talkStr==null)
application.setAttribute( "talk ", "talk ");
else {
}
%>
现在聊天室里有 <%= count %> 位访问者
<% i=count;