void
sendRedirect(java.lang.String location)
This
method declared in HttpServletResponse interface. It redirects the
client request to some other URL(location) for further processing.
It uses a browser redirect. It sends an http response with code 301,
and then the browser makes another request to the new page. So we can
able to see the redirected address in address bar.
Go
through below link for detailed example.
forward(
ServletRequest request, ServletResponse response )
This
method is declared in RequestDispatcher Interface. It forward the
request from a servlet to another resource in the server. Another
resource can be a servlet/jsp/html file. This method must be called
before committing any response to client. Calling of this method
after committing the response cause IllegalStateException.
Go
through below link for detailed example.
No comments:
Post a Comment