Samorix
Samorix

Reputation: 307

J2EE redirect to an external URL

I am developing a web application in which the servlet takes informaiton from index.jsp and does some data processing. After that, I want my application to redirect the user to an external url.

How can I do that? Should I redirect in the servlet or make the servlet call a jsp page which calls the url? and how to do that explicitly?

Thank you in advance!

Upvotes: 0

Views: 8459

Answers (3)

user4022922
user4022922

Reputation:

There is no need for creating a seperate jsp for url redirection. After performing the required operations in the servlet, simply call sendredirect method of the response object.
'reponse.sendRedirect(url)' will do.

Upvotes: 2

kratostoical
kratostoical

Reputation: 84

I think below URL should help you:

how to redirect from servlet to jsp page

If the redirect should happen based on some condition use the following in an if condition based on request data you get from index.jsp.

response.sendRedirect("http://www.google.com");

Upvotes: 3

Jyoti Vaidya
Jyoti Vaidya

Reputation: 3

make the servlet call a jsp page which calls the url.

Upvotes: -1

Related Questions