How does a servlet handle a scenario where it needs to redirect a client to an external website for authentication?

  • request.getRequestDispatcher("externalURL").forward()
  • request.sendRedirect("externalURL")
  • response.forward("externalURL")
  • response.sendRedirect("externalURL")
To redirect a client to an external website, a servlet should use response.sendRedirect("externalURL"). This method sends a temporary redirect response to the client, changing the URL in the browser to the specified external URL.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *