request.getRequestDispatcher等一批函数都不能用,编译出错

ck4 2002-04-28 01:21:59
错误信息如下:
F:\develop\tomcat\seaskyOffice\WEB-INF\classes>javac com\seaskysoft\servlets\*.j
ava
com\seaskysoft\servlets\ActionUtils.java:36: cannot resolve symbol
symbol : method getRequestDispatcher (java.lang.String)
location: interface javax.servlet.http.HttpServletRequest
RequestDispatcher rd = request.getRequestDispatcher(url);
^
com\seaskysoft\servlets\DispatcherServlet.java:36: cannot resolve symbol
symbol : variable request
location: class com.seaskysoft.servlets.DispatcherServlet
HttpSession session=request.getSession();
^
com\seaskysoft\servlets\DispatcherServlet.java:39: cannot resolve symbol
symbol : method setAttribute (java.lang.String,com.seaskysoft.manager.userBean
)
location: interface javax.servlet.http.HttpSession
session.setAttribute("user",user);
^
com\seaskysoft\servlets\DispatcherServlet.java:109: cannot resolve symbol
symbol : method getAttribute (java.lang.String)
location: interface javax.servlet.http.HttpSession
if (session.getAttribute("user").getIsLoged==true) {
^
Note: com\seaskysoft\servlets\LoginAction.java uses or overrides a deprecated AP
I.
Note: Recompile with -deprecation for details.
4 errors
是怎么回事?
...全文
135 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
dylanwolf 2002-04-29
  • 打赏
  • 举报
回复

classpath 不对吧, 没有include 相应的包。
gzwrj 2002-04-29
  • 打赏
  • 举报
回复
You must update your servlet.jar to version2.x or later.
kkhui 2002-04-29
  • 打赏
  • 举报
回复
javac -classpath %TOMCAT_HOME%/lib/servlet.jar;. ActionUtils.java
ck4 2002-04-28
  • 打赏
  • 举报
回复
package com.seaskysoft.servlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

/**
* This class contains utility methods used by the Action objects
* in the Project Billboard application.
*
* @author Hans Bergsten, Gefion software <hans@gefionsoftware.com>
* @version 1.0
*/
public class ActionUtils {

public String getShowPageURL(HttpServletRequest request, String page) {
return request.getContextPath() + request.getServletPath() +
"?action=showPage&page=" + page;
}
public void forward(String url, HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
RequestDispatcher rd = request.getRequestDispatcher(url);
rd.forward(request, response);
}
}

这是其中一个,RequestDispatcher rd = request.getRequestDispatcher(url);出错,request.getContextPath()也出错,说unresolved symbol.包应该没问题了吧。我可是全都包含近来了。
可乐加水 2002-04-28
  • 打赏
  • 举报
回复
相应的包你包含进来了吗
leonzhao 2002-04-28
  • 打赏
  • 举报
回复
我建议你把程序貼上来看看。
ck4 2002-04-28
  • 打赏
  • 举报
回复
leonzhao(灯泡) :
我用的是jdk1.4,tomcat3.2。怎么回事啊,实在是搞不懂!
leonzhao 2002-04-28
  • 打赏
  • 举报
回复
我编译成功了啊?!!

你是不是搞错了?

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧