Question - Can you send an Authentication error from a Servlet?
Answer -
Yes, we can use setStatus(statuscode) method of HttpServletResponse to send an authentication error. All we have to do is to set an error code and a valid reason along with the error code.
1 response.sendError(404, "Page not Found!!!" );