Question
What is difference between ServletResponse sendRedirect() and RequestDispatcher forward() method

Answers

• RequestDispatcher forward() is used to forward the same request to another resource whereas ServletResponse sendRedirect() is a two step process. In sendRedirect(), web application returns the response to client with status code 302 (redirect) with URL to send the request. The request sent is a completely new request.

• forward() is handled internally by the container whereas sednRedirect() is handled by browser.

• We should use forward() when accessing resources in the same application because it’s faster than sendRedirect() method that required an extra network call.

• In forward() browser is unaware of the actual processing resource and the URL in address bar remains same whereas in sendRedirect() URL in address bar change to the forwarded resource.

• forward() can’t be used to invoke a servlet in another context, we can only use sendRedirect() in this case.   Your Comment




More Software,Java Questions..
What is the inputsplit in map reduce software?

Can variables be used in Java without initialization?

What is the difference between java bean and enterprise java bean?

What is software configuration management?

How does the java database connectivity (jdbc) work?

What are the advantages of threads in java?

What Is Java Api For Xml-based Rpc (jax-rpc)?

How can you implement fine-grained auditing?

What is IBM’s simple explanation for Big Data’s four critical features?

What is static synchronized method in JDBC API? Give an example?

What does the NULLIF function do?

What happens if a start method is not invoked and the run method is directly invoked?

Should we override finalize method

what is the difference between mysql_fetch_array and mysql_fetch_object?

How will XML affect my document links?

What is object cloning in Java?

Why to use Style Sheets?

What are Filters in MVC?

Can you explain Application layer in OSI model?

How to define new testplan attributes?



Search
Can you Answer!!
  • Q What is the Islamic view point concerning reservation for backward classes of people?
  • Q Why have you applied to our firm?
  • Q Image can be sent over telephone lines by using ---
  • Q Match the characteristics with their market structur: (a) Expand out put until MC = MR - Monopolistic competition (b) Elasticity of demand depends on procing policies of rivals
  • Q I can't create movies. What's the problem?
  • Q How we can optimize qv application?
  • Q In teradata, what is the significance of upsert command?
  • Q Differentiate between truncate and delete.
  • Q How to access the inner class from code within the outer class
  • Q How can we send data to external programs?
  • Q What's the use of System.Diagnostics.Process class?