Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect pages in JSP?

Tags:

java

redirect

jsp

I have to design several pages in jsp. After clicking on the submit button on the first page, the page should be automatically redirected to the second page.

Can you help with a quick example or a link to a tutorial that demonstrates how to implement this?

like image 735
PROXY Avatar asked Feb 11 '11 09:02

PROXY


People also ask

How do I redirect from one page to another in JSP?

The page redirect is used to move the redirect response to another resource of the web page. Basically we can call the redirect pages using sendRedirect() method in the jsp on client-side request can be used within the server or outside of the server.

How do I forward one JSP Onclick to another JSP?

Just use two forms. In the first form action attribute will have name of the second jdp page and your 1st button. In the second form there will be 2nd button with action attribute thats giving the name of your 3rd jsp page.

What is response sendRedirect in JSP?

sendRedirect() accepts the respective URL to which the request is to be redirected. Can redirect the request to another resource like Servlet, HTML page, or JSP page that are inside or outside the server. It works on the HTTP response object and always sends a new request for the object.


1 Answers

<%     String redirectURL = "http://whatever.com/myJSPFile.jsp";     response.sendRedirect(redirectURL); %> 
like image 65
oopbase Avatar answered Sep 18 '22 23:09

oopbase