我建立了一个helloapp  web工程
在部署Servlet时建立了一个DispatcherServlet.java文件
文件如下:************
DispatcherServlet.java
************package mypack;import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;public class DispatcherServlet extends HttpServlet
{

private String target = "/hello.jsp";

public void init(ServletConfig config)
throws ServletException{super.init(config);}

public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{
//Get the username from the request
String username = request.getParameter("username");
//Get the password from the request
String password = request.getParameter("password");

//Add the user to the request
request.setAttribute("USER", username);
request.setAttribute("PASSWORD", password);

//Forward the request to the target named
ServletContext context = getServletContext();

System.out.println("Redirecting to "+target);
RequestDispatcher dispatcher = context.getRequestDispatcher(target);
dispatcher.forward(request, response);
}

public void destroy(){}
}没有提示错误:)
但在运行时只有  Run..  选项
是不是没有main方法就不能编译
但它的步骤就是编译并发布此文件-----郁闷!在dos中运行时却提示了老多错误软件包javax.servlet不存在
软件包javax.servlet.http也不存在
但明明在工程中呢-------郁闷请大家给指点一下
谢谢!