Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using RequestDispatcher Forward with a full URL

807605Aug 14 2007 — edited Aug 14 2007
Good Morning!

I would like to use the RequestDispatcher forward method to send people to a new page. I have the code below, but I get an error that the redirect must start with a /.

Example Code, If I have Google.jsp with this code:
<%@ page import="java.io.*,java.util.*,javax.servlet.*,javax.servlet.http.*;"%>
<%
	RequestDispatcher rd = getServletContext().getRequestDispatcher("http://www.google.com");
	rd.forward(request, response);
%>
I want the browser to have http://localhost:8080/Google.jsp in the address bar and the google page in the window.

Can anyone help with this?

Thanks,
Doug
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 11 2007
Added on Aug 14 2007
2 comments
1,750 views