What is the difference between jsp:forward and response.sendRedirect(url),?.

By: Karthik Printer Friendly Format    

Question: What is the difference between <jsp:forward page = ... > and
Answer: The <jsp:forward> element forwards the request object containing the client request information from one JSP file to another file. The target file can be an HTML file, another JSP file, or a servlet, as long as it is in the same application context as the forwarding JSP file. 
sendRedirect sends HTTP temporary redirect response to the browser, and browser creates a new request to go the redirected page. The  response.sendRedirect kills the session variables.

Most Viewed Articles (in Interview )

What are types of J2EE clients?

Interview Question: Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?

Explain the Polymorphism principle.

What are all the different scope values for the tag?

Interview Question: What is Struts?

Interview Question: Why do we need Struts?

Interview Question: Who wrote Struts?

Interview Question: How do I install Struts?

Interview Question: What is EJB container?

Interview Question: What is Deployment descriptor?

Interview Question: What is the difference between sessioncontext and entitycontext?

Interview Question: What is lazy loading?

Interview Question: How many EJB Objects are created for a Bean?

Interview Question: What is local interface. How values will be passed?

Getting started with Interview

Latest Articles (in Interview)

Comment on this tutorial