Your problem is here:

  public void doGet( HttpServletRequest req,
  HttpServletResponse res)
         throws ServletException, IOException {

You may not override the doGet method. If you want to throw an IOException from
within doGet, you first have to catch the IOException, set some message (it
could be the text of the IOException, stack trace, etc), and then throw a new
ServletException with that text as the text of the exception.
Like this:

doGet(HttpServletRequest req, HttpServletResponse res)
  throws ServletException
{
    <some stuff here>
    try
    {
         <some database stuff>
    }
    catch(IOException ioException)
    {
        String ioe = ioException.toString;
        throw new ServletException(ioe);
    }
}

Then, you have to catch the server exception 500 (ServletException) that you
threw in the servlet. Typically, we call a servlet from a jsp. This makes it
easy to catch servlet errors because all you need to do in your jsp that calls
the servlet is:
<@ page isErrorPage = "false" %>
<@ page errorPage = "error.jsp" %>   (or some other error page)

In error.jsp (the page that actually catches the exception):
<@ page isErrorPage = "true" %>
And display some friendly error message or whatever.


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to