How to forward a page from servlet to jsp
I've been trying to display a page from servlet transfer to jsp page.
here is my code.
String address = "http//localhost/WebApp/TestParam/final.jsp";
HttpSession session = request.getSession();
ServletContext sc = session.getServletContext();
RequestDispatcher dispatcher = sc.getRequestDispatcher(address);
dispatcher.forward(request,response);
I can't get to final.jsp page. It shows that request no found.
Please help to give solution on this.
[503 byte] By [
wesleygcha] at [2007-11-27 0:55:17]

# 2
Most likely you misunderstood the purpose of requestDispatcher.
Read the first sentence of the API: http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/RequestDispatcher.html
Defines an object that receives requests from the client and sends them to any resource (such as a servlet, HTML file, or JSP file) on the server
This means that you have to define the "address" pointing to a resource on the same server. For example this uri: "/WebApp/TestParam/final.jsp".
If you want to redirect to external resources, then indeed use HttpServletResponse#sendRedirect() with a http:// uri.