response.setStatus(HttpServletResponse.SC_NOT_FOUND);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);This code example sets the status code for the HttpServletResponse object to 500. This is useful when you want to indicate to the client that there was an internal server error that prevented the requested resource from being processed. Package library: javax.servlet.http