JSP做聊天室程序,调试出错?请高手指点!!!

szasgmg 2001-11-10 03:41:31
下面是聊天室初始化程序,但编译不能通过,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]

请问问题出在哪里?谢谢!
...全文
42 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
szasgmg 2001-11-10
那在Weblogic下怎么解决呢?
回复
karma 2001-11-10
sorry, I was wrong, but your original code runs fine on TOMCAT 4
回复
szasgmg 2001-11-10
还是不能通过!
回复
karma 2001-11-10
try
page.getServletContext()?
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2001-11-10 03:41
社区公告
暂无公告