主题:再次请教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]
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]