What is difference between Forward() and sendRedirect()
methode?

Answer Posted / venkat

forward() method send source prg to target web resource prg
in same web application.and use source and target web
resource prg are use same req,res objects so will use data
in target web resource prg.

rd.forward(req,res)

sendRedirect() method send source web resource prg to target
web resource prg in same webapplication or two different web
applications in same server or different servers.and this
method will not use same req,res objects so if you want to
send data source to target web resource prg use query
string.

r.sendRedirect("srv2"?a=10);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is tomcat a servlet container?

577


Explain web container.

569


How would you create deadlock on your servlet?

622


When to use doget() and when dopost()?

629


How we can get ip address of client in servlet?

540






How to make sure a servlet is loaded at the application startup?

557


how to link html file to sevlet file.one name is textbox,c&c++ is cheakbox,bc&mca is radio button and one submit buttonis ok why in this programme use in servelt file

2085


What is servlet api used for conneting database?

698


Write a simple servlet program to print the contents of html.

551


What is the difference between using getSession(true) and getSession(false) methods?

571


What if you need to span your transaction across multiple servlet invocations?

581


How does Cookies work in Servlets?

651


Why do we have servlet wrapper classes?

579


How can I send user authentication information while making URL Connection?

547


What is servlet and how it works?

508