• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interview question regarding sendRedirect() and Forward()

 
praneeth gajji
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was asked in an interview like "say we have two war files output of one servlet in one war file generates JSp in tht war and its that will have input to other servlet in another war file and it generates a JSP with output,user is bothered only output of second war file where as request starts from first war file,here which one we have to use wheter Sendredirect() or forward() with requestDispatcher" ..

Please explain eloborately.Thanks in Advance....
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not getting your question.

just I am guessing you need to talk to another web application? then you *cant* use forward which is used on server side(particular).
 
Mohana Rao Sv
Ranch Hand
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here the interviewer testing your basic skills on servlets.

Send Redirect

Forward

Forward vs SendRedirect.
 
arulk pillai
Author
Ranch Hand
Posts: 3388
 
praneeth gajji
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply,I am explaining question clearly please provide me solution.


"In An application server there are 2 war files output of one war file is input to other war file.user is concerned about final output that is coming.Request is made for first war file where as final response i from 2nd war file."

In the above situation which one we use(sendRedirect or forward) and why.Explain me, I am in little bit confusion..
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if both wars are in same server then, you can use forward on context(only some server support it.) . otherwise use redirect with query string.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic