• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference Between Client side Redirect and Server Side Redirect

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a dfoubt We will say sendRedirct() is Client side Redirect and RequestDispatcher() is Server Side Redirct How they both will work exactly.


Any One Please.......


Thank uuuuu
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forward and Redirects: The forward and redirect operations both replace content. The current page or output stream is terminated, and is replaced with the output of the specified page.

Forwards: Both <jsp:forward> and RequestDispatcher.forward() are what I refer to as "server-side" redirects. The redirect operation is performed in the server side, and the browser is unaware of the change. If page1.jsp forwards to page2.jsp, the browser's address bar will still show page1.jsp

Redirects: The response.sendRedirect() is what I call a "client-side" redirect. The redirect operation is passed to the browser, which is aware of the change. If page1.jsp redirects to page2.jsp, the browser's address bar be updated to show page2.jsp.

Forwards vs. Redirects: You choose between forwards and redirects depending on how you want the browser to be affected. Forward operations are faster, because all the processing happens server-side. Redirect operations update the browser history, however, which is often desirable.

If you forward between page1 and page2, if the user's clicks the "refresh" or "reload" button, both page1 and page2 are executed a second time. On the other hand, if you use a client-side redirect, the browser's address information is updated. If the user clicks refresh, only page2 are re-executed.
 
Ranch Hand
Posts: 502
jQuery Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sendRedirct() : server sends HTTP response code 302 with the URL of new location which you pass as parameter to sendRedirct() method to the Client. Client will know "what is happening?".


forward() : Server transfers control to the Resource you pass as a parameter to RequestDispatcher. Client will not know about this.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi sirisha
redirect means the control will goes to anothre url for example mailcity.com is one famous site that will be purchesed by lycos.com when ever the user login to the mailcity.com the request will goes to lycos or it will give status code as 302.requestdispatcher will have two methods include() & forward(),In forward the control will goes to another jsp,and in include just we will include jsp.

thanks,
vishnu.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vishnu,
Welcome to JavaRanch!

We're pleased to have you here with us in the servlets forum, but there
are a few rules that need to be followed, and one is that proper names are
required. Please take a look at the
JavaRanch Naming Policy and
adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

You can change it here


It looks like you've already been asked to change it 3 times.
Your account will be closed very shortly if the screen name is not updated.
[ December 19, 2006: Message edited by: Ben Souther ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"vishnu", your final warning was delivered in this topic.

Your account has been disabled.

Should you wish to reinstate your account, you must contact me via email.

bear
JavaRanch Sheriff
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic