Reputation: 307
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
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
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