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
how many jsp scripting elements are there and what are those?
Define context initialization parameters.
What is servlet collaboration?
Which exception is thrown if the servlet is not initialized properly?
What are the supporting protocol by HttpServlet ?
Can we use threads in Servlets?
Explain jsessionid and when is it created?
What is servlet attributes and their scope?
What are the differences between servlet context vs servlet config?
What are the two important api's in for servlets?
What do you mean by cgi in servlet?
What is the process to implement doget and dopost methods?
What is the difference between a generic servlet and http servlet?
When a servlet accepts a call from a client, it receives two objects. What are they?
Can you send an authentication error from a servlet?