Suppose you had a servlet that simply returned an error message because that resource was forbidden to that user. Read the following code snippet:
1.public void service(HttpServletRequestrequest,
2.HttpServletResponseresponse)
3.throws ServletException, IOException
4. {
5.
6. }
What code would you type on line 5 to return an error message to the requesting client?
Correct Answer: response.sendError(HTTPServletResponse.SC_FORBIDDEN,"Error");
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More JSP And Servlets MCQ Questions