forward() method
Example:
Example:
- The forward() method works at server side.
- The forward() method work within the server only.
- It sends the same request and response objects to another servlet.
- Visually we are not able to see the forwarded address, its is transparent
- Using forward () method is faster then send redirect.
Example:
sendRedirect() method
- The sendRedirect() method works at client side.
- It can be used within and outside the server.
- It always sends a new request.
response.sendRedirect("SecondServlet"); |