JSP做聊天室程序,调试出错?请高手指点!!!
下面是聊天室初始化程序,但编译不能通过,JSP引擎是weblogic6.1:
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="java.util.*"%>
<html>
<head>
<title>初始化聊天室</title>
</head>
<body>
<%
//init the chat msg
Vector chatMsgVector=new Vector();
chatMsgVector.addElement("<font color='red' size='2'>欢迎来到聊天室!</font><br>");
//the following code are used to init the welcome msg
getServletContext().setAttribute("msg",chatMsgVector);
//init the user list
Vector chat_user=new Vector();
//medet is the opertor
chat_user.addElement("medet");
getServletContext().setAttribute("user_list",chat_user);
%>
</body>
</html>
出现的问题(节选一部分):
F:\bea\wlserver6.1\config\itcenter\applications\DefaultWebApp\WEB-INF\_tmp_war_lover_lover_DefaultWebApp\jsp_servlet\_chat\__init_chat.java:97: cannot resolve symbol
probably occurred due to an error in /chat/init_chat.jsp line 13:
getServletContext().setAttribute("msg",chatMsgVector);
Full compiler error(s):
F:\bea\wlserver6.1\config\itcenter\applications\DefaultWebApp\WEB-INF\_tmp_war_lover_lover_DefaultWebApp\jsp_servlet\_chat\__init_chat.java:97: cannot resolve symbol
symbol : method getServletContext ()
location: class jsp_servlet._chat.__init_chat
getServletContext().setAttribute("msg",chatMsgVector); //[ /chat/init_chat.jsp; Line: 13]
请问问题出在哪里?谢谢!