• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Redirect to jsp from another jsp

 
Anwar Hussain
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How To Redirect to jsp from another jsp
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64181
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the <jsp:forward page="/page.jsp" /> standard action ...

note that there must no response have been committed as otherwise the forward would fail
 
Sreenath Rajagopal
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow!!
can use

<jsp:forward > or response.sendRedirect(url);
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64181
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that a forward is not a redirect.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64181
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64181
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point about the redirect as well. In a properly structured web app, JSPs are end-points.
 
pradeepa sakthi
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
you can use

response.sendRedirect("a.jsp");
 
Anwar Hussain
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pradeepa sakthi wrote:hai,
you can use

response.sendRedirect("a.jsp");




Thanks Everybody.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic