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

Servlet is pure java object or not?

719


What is the use of httpservletrequestwrapper and httpservletresponsewrapper?

545


What are different Authentication options available in Servlets.

569


What is the use of httpservletrequestwrapper?

592


Describe the phases of servlet lifecycle?

634






Explain the lifecycle of a servlet?

511


What is servlet initializer?

505


In the servlets, we are having a web page that is invoking servlets ,username and password? which is checks in database? Suppose the second page also if we want to verify

586


What is the difference between jsp and servlet life cycle?

693


How to get the IP address of client in servlet?

632


Why are servlets used?

534


How can we create deadlock situation in servlet?

853


What is context in servlet?

540


What's the servlet interface?

598


What is the difference between get and post methods?

604