Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

difference between sendredirect,forward and url rewritting

Answer Posted / chandra kunchala

SendRedirect():

1.
this is used to transform the request from one
container to another or from one web-application to another
or with in the web-application also
This happens at client side. this will applicable in
the same container as well as different container which are
located in different places.
2.
when ever browser sending the request to the
server. but that server is responsible to provide the
response for that request then that server delegates that
reuest(re-direct) to the same client with status code:302
and location of other server in which where we can get the
actual response fot that request.
3.
By seeing that status code:302, the browser creates
another request object and send to the another
servlet(anothere servlet) which is by seeing in location
header that was send by the first server.
4.
then the second server will responsible to generate the
actual response fot that request.

5.
here the request comes back to the cleint foa making
another request to another server right? so, there may be
chanse of traffic problems in the transimittin the request
or response.

6.
performance will automaticall reduce.
7.

after commiting the response to the client, we are
not allowed to use response.sendRedirect() method. if we are
use that, we will get RuntimeException saying
illegalStateException.
we can see on browser addressbar with new address of the
second server (servlet)
now.... forward():
1.
this is also used forward the request from one place
to another but it should be in the same web-container.
2.
it will happens at server side.
performance will increase compared to sendRedirect()
3.
after committing the response we are not forward the
request to another like sendRedirect()..

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to get the current httpsession object?

1112


How is the get () method different from the post() method?

968


What is the difference between forward () and sendredirect () functions in servlet? Explain

1027


How can you create a session in servlet?

1136


What are all the ways for session tracking?

1157


Which java framework is most popular?

1133


What do you mean by mime type?

974


What are the kinds of http requests?

1032


What is the difference between get and post methods?

1034


What is the use of java servlet api?

1029


What is the major difference between context parameter and context attribute?

1101


What do you mean by default initialization in java servlet?

1093


Explain the role of dispatcherservlet and contextloaderlistener.

1181


Which protocol will be used by browser and servlet to communicate

1051


What are some advantages of storing session state in cookies?

1012