Page 1 of 1

About Question enthuware.jwpv6.2.798 :

Posted: Sat May 14, 2016 7:20 pm
by himaiMinh
For option 1, I can demo even though it is not the best way to handle exception :

Code: Select all

public class MyServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
         try{
             throw new IOException();
         }
         catch (IOException e){
              request.getRequestDispatcher("errorPage.jsp").forward(request, response);
         }
    }
}

Re: About Question enthuware.jwpv6.2.798 :

Posted: Sat May 14, 2016 8:24 pm
by admin
Correct. But this is not the only solution, which is what the option says, "cannot be done...unless the exception is caught in the servlet". That is why this option is incorrect.