hi folks.

i�m using my own taglib for generating dynamic tables. i�m also using the
errorPage-directive on all my pages (works fine).
the tags do all call a method getContent() in their doStartTag-method which
is used to build the html-content-string so when an error (e.g.
database-access) occurs in getContent() it throws a simple exception (incl.
message) which is caught in the doStartTag()-method. in this case i raise a
javax.servlet.jsp.JspTagException with the same message hoping it to be
registered on the page the tags are included in and then of course handled
by my error-page.

  public int doStartTag()
  throws javax.servlet.jsp.JspTagException {
    ...
    try {
      getContent();
    } catch (Exception e) {
      throw new javax.servlet.jsp.JspTagException(e.getMessage());
    }
    return SKIP_BODY;
  }

the error-page looks like this:

  <%@ page import="java.io.*,java.util.*" isErrorPage="true" %>
  <html>
  <head>
  <title>Error</title>
  </head>

  <body>

  Exception: <%= exception %><br>
  <br>
  Exception-Message:<br>
  <jsp:scriptlet>
    ByteArrayOutputStream ostr = new ByteArrayOutputStream();
    exception.printStackTrace(new PrintStream(ostr));
    out.print(ostr);
  </jsp:scriptlet>

  </body>
  </html>

astonishingly the the 3rd page (which contains the tags) outputs all
content until the exception occurred and then just appends the output of
the error page like this:

  <html>
  // normal output until exception occurs goes here...
  ...
  // the tag is called HERE
  <html>
  <head>
  <title>Error</title>
  </head>

  <body>

  Exception: <br>
  <br>
  Exception-Message:<br>

why isn�t the exception forwarded to the error-page but the error-page
included in the other page instead?

thanx 4 your help in advance!

greetings

steffen

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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