Question: Difference between forward and sendRedirect in JSP?

By: Guru Singh Printer Friendly Format    

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 )

What types of comments are available in the JSP?

Why J2EE is suitable for the development distributed multi-tiered enterprise applications?

Interview Question: Why do we need Struts?

Interview Question: Is Struts compatible with other Java technologies?

Question: What is a Hidden Comment in JSP?

Differentiate between .ear, .jar and .war files.

Explain the Polymorphism principle.

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

What is the difference between Session Bean and Entity Bean?

What is Collection API?

What is similarities/difference between an Abstract class and Interface?

Interview Question: What is EJB container?

Interview Question: What is EJB client JAR file?

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

What are the call back methods in Session bean?

Latest Articles (in Interview)

Comment on this tutorial