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...


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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / farhaananwar

Foward action is done at server site without interference of
web browser even the old URL is not changed whereas request
is forwarded to new resource hence forward action is faster
than redirect action. when forward operation is performed
request attributes and session attributes persists.
In case of redirection. servlet container sends the
response to clien web browser by setting status to
HttpServletResponse.SC_TEMPORARY_REDIRECT and location
header
to the new URL address where browser will have to redirect
new request automattically without interference of client.
when browser redirect new request to resource, the URL in
web browser changed. This proccess is slower than forward
because server send response to browser telling that
resource requested is moved temporary to other resource and
need redirction and then browser take action. The request
paramters are persist in new redirect request.

Is This Answer Correct ?    1 Yes 3 No

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

Answer / lala mishra

i will tell the conclusion of all
1. in case of forword() server will not inform client
2. in case of forword the same request will be sent to other
resourse so that request attribute will not distroy.

the opposite is for sendRedirect.

Is This Answer Correct ?    0 Yes 4 No

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

Answer / farhaananwar

Foward action is done at server site without interference of
web browser even the old URL is not changed whereas request
is forwarded to new resource hence forward action is faster
than redirect action. when forward operation is performed
request attributes and session attributes persists.
In case of redirection. servlet container sends the
response to clien web browser by setting status to
HttpServletRequest.SC_TEMPORARY_REDIRECT and location header
to the new URL address where browser will have to redirect
new request automattically without interference of client.
when browser redirect new request to resource, the URL in
web browser changed. This proccess is slower than forward
because server send response to browser telling that
resource requested is moved temporary to other resource and
need redirction and then browser take action. The request
paramters are persist in new redirect request.

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More Servlets Interview Questions

What is the difference between ExecuteUpdate and ExecuteQuery?

4 Answers  


What are the different types of servlets?

0 Answers  


What are the functions of the servlet container?

0 Answers  


Can we define constructor in Servlet class?

10 Answers   Accenture, Yugma,


can anybody send me j2ee softwares such as tomcat,weblogic server ,netbeans

2 Answers  


How do you design microservices?

0 Answers  


How do you load an image in a Servlet?

0 Answers  


give the syntax of doGet() and doPost()?

2 Answers  


What is load-on-startup in servlet?

0 Answers  


can servlet have instance variables?

8 Answers   Syscon, Wipro,


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

0 Answers  


What compiler do not do if we create our own constructor?

5 Answers   HCL,


Categories