The moose likes JSP and the fly likes How To Redirect to jsp from another jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How To Redirect to jsp from another jsp" Watch "How To Redirect to jsp from another jsp" New topic
Author

How To Redirect to jsp from another jsp

Anwar Hussain
Ranch Hand

Joined: Jul 24, 2009
Posts: 35
How To Redirect to jsp from another jsp
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

Please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

Using a title of "Servlet" in a forum completely dedicated to questions on Servelts isn't very helpful.

Please go back and change your post to add a more meaningful subject by clicking the

Moreover, your question isn't about servlets, it's a JSP question. So, please take the time to choose the correct forum for your posts. This forum is for questions on Servlets.

For more information, please read this.

This post has been moved to the JSP forum.

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
use the <jsp:forward page="/page.jsp" /> standard action ...

note that there must no response have been committed as otherwise the forward would fail


JDBCSupport - An easy to use, light-weight JDBC framework -
Sreenath Rajagopal
Greenhorn

Joined: Mar 19, 2007
Posts: 7
wow!!
can use

<jsp:forward > or response.sendRedirect(url);
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

Note that a forward is not a redirect.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
true, forward happens on the server side ... no 302 status code is send back to the server that tell the browser to 'redirect' to another page ...

but i guess what you meant was forwarding...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

Sebastian Janisch wrote:but i guess what you meant was forwarding...

Why, when forwarding was not mentioned in the question?

It's also extremely rare to forward from one JSP to another in a well-structured web app.
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
Bear Bibeault wrote:Why, when forwarding was not mentioned in the question? .


true, but i guess since redirecting from a jsp to another is even more uncommon than forwarding, i concluded that forwarding was meant ... my bad
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56529
    
  14

Good point about the redirect as well. In a properly structured web app, JSPs are end-points.
pradeepa sakthi
Greenhorn

Joined: Dec 26, 2008
Posts: 11
hai,
you can use

response.sendRedirect("a.jsp");
Anwar Hussain
Ranch Hand

Joined: Jul 24, 2009
Posts: 35
pradeepa sakthi wrote:hai,
you can use

response.sendRedirect("a.jsp");




Thanks Everybody.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How To Redirect to jsp from another jsp
 
Similar Threads
Auto Redirect Jsp Page
In how many ways we can call another servlet from the doPOST()
redirect from jsp after download
how to redirect from a single servlet to more than one jsp's?
response.addHeader question.