一个困扰我许多天的问题拜托了(聊天室)
本人作了一个聊天室,一个主页面chatframa.jsp,发言页面say.jsp,传输信息页面send.jsp,显示页面mai.jsp。chatfram.jsp是一个框架,上部显示信息,下部发言。但是当我按“发言”按钮时,框架上部显示不出信息。下面是send.jsp中存储信息的一段程序:String words=("<font color="+color+">"+user+"</font>"+action+"对<font color="+color+">"+sayto+"</font>说:<font color="+color+">"+word+"</font>");
Vector msg=new Vector();
msg.addElement(words);
getServletContext().setAttribute("msg",msg);
Vector user_table=new Vector();
user_table.addElement("user");
getServletContext().setAttribute("user_table",user_table);
msg=(Vector)getServletContext().getAttribute("msg");
我想知道存储在"application"中的"words"怎么被"mai.jsp接收到,使他能在"chatfram.jsp"中显示。下面是"mai.jsp"的一段程序: msg.addElement("<font color='red'>"+user+"来了,大家好好的对他哦.</font>");
getServletContext().setAttribute("msg",msg);
msg=(Vector)getServletContext().getAttribute("msg");
for (int i=msg.size();i>0; i--)
{
out.print(msg.elementAt(i-1));
out.print("<br>");
}请多指教!