I have a problem when I want use RequestDispatcher.
I work under Windows, with JSWDK 1.0, and I compile my code with JDK 2.0
and Servlet API 2.1.
When I try to run my code, I get 404 error, but I execute the followed
lines (requestDispatcher.forward(request, response);
System.out.println("Chaining done");). because the requestDispatcher is
not null. I have verified, the file index.html exists under the root
directory of the http server (http://localhost:8080/index.html is good).
Can you help me please.
Thank in advance.
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletChain2 extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
System.out.println("Initializing servlet");
// RequestDispatcher requestDispatcher;
RequestDispatcher requestDispatcher =
getServletContext().getRequestDispatcher("/index.html");
if (requestDispatcher != null) {
requestDispatcher.forward(request, response);
System.out.println("Chaining done");
}
else {
response.sendError(response.SC_NO_CONTENT);
System.out.println("Chaining failed");
}
}
}
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html