include () method
- Includes the content of a resource (servlet, JSP page, or HTML file) in the response.
forward() method
- Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server.
- The forward() method works at server side.
- It sends the same request and response objects to another servlet.
- It can work within the server only.
- Ex: request.getRequestDispacher("servlet2").forward(request,response);
sendRedirect() method
- The sendRedirect() method works at client side.
- It always sends a new request.
- It can be used within and outside the server.
- Ex: response.sendRedirect("servlet2");
No comments:
Post a Comment