回 帖 发 新 帖 刷新版面

主题:再次请教servlet问题

我用eclipse建了一个动态网站工程test,在JavaSource目录下有个包a001,在这个包下有一个A001servlet.java文件和一个databean.java文件,但当我分别运行它们时报错
type Status report

message /test/WEB-INF/classes/aoo1/A001servlet.java

description The requested resource (/test/WEB-INF/classes/aoo1/A001servlet.java) is not available.


--------------------------------------------------------------------------------
type Status report

message /test/WEB-INF/classes/aoo1/Databean.java

description The requested resource (/test/WEB-INF/classes/aoo1/Databean.java) is not available.


--------------------------------------------------------------------------------


[em10][em10][em10][em10]
源文件如下:
A001servlet.java

package aoo1;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class A001servlet extends HttpServlet
{
     private static final String CONTENT_TYPE = "text/html; charset=GBK";
    
     public void init() throws ServletException
      {
      }      
    
    
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        Databean data=new Databean();
        out.print(data.getstr());
        out.print("hello world");
        
       
    }      
    
    
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        doGet(request, response);
    }
    
    public void destroy() {
      }
}


databean.java

package aoo1;

public class Databean {
    String a="ksjfkjksjf";
  public String getstr()
  {
      return a;
  }
}
急待帮助,谢谢各位了[em10][em10]

回复列表 (共3个回复)

沙发

你确定只有java文件?

板凳

确定

3 楼

你编译后的 class文件呢?

我来回复

您尚未登录,请登录后再回复。点此登录或注册