Difference between Include, Forward and sendRedirect in
Servlet?
Answer Posted / samit katiyar
forward() should be called before the response has been
committed to the client (before response body output has
been flushed). If the response already has been committed,
this method throws an IllegalStateException. Uncommitted
output in the response buffer is automatically cleared
before the forward.
While with include()...... The request and response
parameters must be either the same objects as were passed
to the calling servlet's service method or be subclasses of
the ServletRequestWrapper or ServletResponseWrapper classes
that wrap them.
Is This Answer Correct ? | 8 Yes | 3 No |
Post New Answer View All Answers
Why do we have servlet listeners?
What is ServletContext object?
Explain request dispatcher and its methods.
When should you prefer to use doget() over dopost()?
What is a generic servlet?
What are the differences between forward() method and sendredirect() methods?
What are the objects involved when a servlet receives a call from client?
What is context in servlet?
What is URL Encoding?
Define context initialization parameters.
Differentiate between the print writer and servlet output stream?
What is the use of servlet context?
If some new data has entered the database, explain how can a servlet refresh automatically?
What are the jobs performed by servlets?
Why are servlets used?