Forwards and Redirects:-

The forward and redirect operation both replace content. The current page is terminated and is replaced with the output of the specified page.

Both <jsp:forward>; and RequestDispatcher.forward() are server side redirects. The redirect operations are performed in the server side, and the browser is unaware of the change. If page1.jsp forwards to page2.jsp the browsers address bar will still show page1.jsp.

The response. Redirect() is 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 browsers address bar will be updated to show page2.jsp.

Forward operations are faster because all the processing happens at the server side.

Redirect operations update the browser history, however which is often desirable. Forward operations are useful when you don’t want the browsers address bar to be update.

With the sendRedirect() you can connect to any URL outside the web application. Whereas the forward () operation will work only within the web application.

Advertisements

One Response to Forwards and Redirects:-

  1. Honeydi says:

    thanks much, guy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: