What is the difference between sendRedirect() and forward()?
in what situations do we have to use send redirect()
instead of forward().

Answer Posted / vinit sharma

Hello i am vinit and according to me,

Both methods are use to transfer form one web component to
another web component.

In case of forward () the same request (that have client
information) is passed from server side to the another page
(this another page should be in the same container (Web
Server)), due to URL remains same.

While in sendRedirect () a new request (due to
loss the previous request information) is generated from
client side to another page (this another page can be in
the same OR in different container (Web Server)), due to
URL becomes change.

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is java servlet container?

510


I Want build and release interview questions

3127


What is difference between j2ee and java?

498


What does application client module contain?

549


Is java is a technology?

523






Is java more difficult than c++?

478


Hi Friends. I want complete technical flow of j2ee project with following technologies. jsp , servlet , Struts , Hibernate , (should follow mvc-2 design pattern) . with DAO ,DTO SERVICE layers .

4403


Explain the four types of container that the j2ee specification defines

492


What is data?

547


What are the differences between Ear, Jar and War files? Under what circumstances should we use each one?

527


for example we are login into the irctc server from there it will go to the selected bank and deduct amount and come back to the irctc. so if we are developing this in java means will it be run on the same session. but as per my knowledge bank is separate and irctc is separate URL's so it will use two different sessions then how it is maintaining same session through out application and even it uses the payment gateway? how it is working can any one help me on that??

3864


What is deployment descriptor?

576


What is digest authentication?

550


How do you compile java?

493


What is javaserver pages (jsp)?

506