Hi all,

I would like to use exception handling correctly in my servlet. Heres the
deal:

I have a servlet that has doPost and doGet methods - doPost and doGet
contain the same code shown below:

public void doPost(HttpServletRequest request, HttpServletResponse response)
throws javax.servlet.ServletException, java.io.IOException
{
        try{

                performTask(request,response);

        }
        catch(ExceptionController exControll)
        {

                //for now we will send the error back
                //latter we will add a class the returns an error page back

response.sendError(response.SC_INTERNAL_SERVER_ERROR,"ExceptionController
Reports: " + exControll.getMessage());

        }

}

Now, the perfromTask method throws an ExceptionController(extends Exception)
instance which is caught in the doGet or doPost methods.  Then I currently
send the error back to the web browser.  The question is: is this good
exception handling??

Best Regards

Marc

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to