Send redirect in servlet
sendRedirect() is present inside the HttpServletResponse interface and redirects the response to another resource.
As per Servlet doc, sendRedirect() sends a temporary redirect response to the client using the specified redirect location URL and clears the buffer. The buffer will
be replaced with the data set by this method. Calling this method sets the status code to SC_FOUND 302 (Found).
This method can accept relative URLs;the servlet container must convert
the relative URL to an absolute URL
before sending the response to the client. If the location is relative
without a leading '/' the container interprets it as relative to
the current request URI. If the location is relative with a leading
'/' the container interprets it as relative to the servlet container root.
if the response has already been committed, this method throws
Example of sendRedirect in servlet :-