Question: Difference between forward and sendRedirect in JSP?

By: Guru Singh  

Question: Difference between forward and sendRedirect?

Answer: When you invoke a forward request, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request. This process occurs completely with in the web container. When a sendRedirtect method is invoked, it causes the web container to return to the browser indicating that a new URL should be requested. Because the browser issues a completely new request any object that are stored as request attributes before the redirect occurs will be lost. This extra round trip a redirect is slower than forward.

 

 

 

 



Most Viewed Articles (in Interview )

Interview Question: Can i map more than one table in a CMP?

Explain the new Features of JDBC 2.0 Core API?

What types of comments are available in the JSP?

How to define an Abstract class?

Interview Question: What is Message Driven Bean?

Types of Interviews

Getting started with Interview

What is the difference between jsp:include page and @ include file?

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?

Interview Question: What is the difference between JavaBean and EJB?

Interview Question: What is abstract schema?

Interview Question: What is the difference between EAR, JAR and WAR file?

Interview Question: What is re-entrant. Is session beans reentrant. Is entity beans reentrant?

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

Interview Question: Is Decorator an EJB design pattern?

Latest Articles (in Interview)

Comment on this tutorial