YouTip LogoYouTip

Jsp Page Redirect

# JSP Page Redirect When you need to move a document to a new location, you need to use JSP redirection. The simplest way to redirect is to use the `sendRedirect()` method of the response object. The signature of this method is as follows: public void response.sendRedirect(String location)throws IOException This method sends the status code and the new page location back to the browser as a response. You can also achieve the same effect by using the `setStatus()` and `setHeader()` methods: ....String site = "" ; response.setStatus(response.SC_MOVED_TEMPORARILY); response.setHeader("Location", site); .... * * * ## Example Demonstration This example demonstrates how JSP performs page redirection: Page Redirect

Page Redirect

Save the above code in a file named `PageRedirecting.jsp`, then visit `http://localhost:8080/PageRedirect.jsp`, and it will take you to [
← Jsp Hits CounterJsp Handling Date β†’