ChatRoom.jsp
<%@page import="java.util.*"%>
<form method=post action="say.jsp">
<input type="text" name="say">
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
<hr />
<%
ArrayList al_say=new ArrayList();
if(application.getAttribute("say") != null)
{al_say=(ArrayList)application.getAttribute("say");
for (int says=0;says<al_say.size();says++)
{
%>
<%=al_say.get(says)%><br><%
}
}
%>
index.jsp
<%@page import="java.util.*"%>
<%
ArrayList al_say=new ArrayList();
application.setAttribute("say",al_say);
response.sendRedirect("ChatRoom.jsp");
%>
say.jsp
<%@page import="java.util.*"%>
<%
String say=new String (request.getParameter("say").getBytes("GB2312"));
ArrayList al_say=new ArrayList();
al_say=(ArrayList)application.getAttribute("say");
al_say.add(say);
response.sendRedirect("ChatRoom.jsp");
%>
<%@page import="java.util.*"%>
<form method=post action="say.jsp">
<input type="text" name="say">
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
<hr />
<%
ArrayList al_say=new ArrayList();
if(application.getAttribute("say") != null)
{al_say=(ArrayList)application.getAttribute("say");
for (int says=0;says<al_say.size();says++)
{
%>
<%=al_say.get(says)%><br><%
}
}
%>
index.jsp
<%@page import="java.util.*"%>
<%
ArrayList al_say=new ArrayList();
application.setAttribute("say",al_say);
response.sendRedirect("ChatRoom.jsp");
%>
say.jsp
<%@page import="java.util.*"%>
<%
String say=new String (request.getParameter("say").getBytes("GB2312"));
ArrayList al_say=new ArrayList();
al_say=(ArrayList)application.getAttribute("say");
al_say.add(say);
response.sendRedirect("ChatRoom.jsp");
%>









