aspose file tools*
The moose likes JSP and the fly likes How To Redirect to jsp from another jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
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: 61413
    
  67

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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: 61413
    
  67

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: 61413
    
  67

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: 61413
    
  67

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://aspose.com/file-tools
 
subject: How To Redirect to jsp from another jsp