Dave,

They code you have shown is not compilable.


        public void test()
        {
                System.out.println( "test" );
                throw new NullPointerException();
                System.out.println( "test" );
        }

would not compile with an error, statement (at line... (the second print
statement) is not reachable ))
however


        public void test()
        {
                System.out.println( "test" );
                if ( true )
                        throw new NullPointerException();
                System.out.println( "test" );
        }

does compile..

Change your code to...

<%
        if ( true ) throw new NullPointerException();
%>


*** You must use an Exception that extends RuntimeException or is a
Throwable or else it most likely will still not compile,
since the method declaration does not define exception to be thrown.

-Rich.

-----Original Message-----
From: Dave Townsend [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 12, 1999 2:40 PM
To: [EMAIL PROTECTED]
Subject: Re: Errorpage directive


I have just tried this as the page causing the error:

-----
<%@ page language="java" errorPage="http://localhost/error.jsp" %>

<HTML>
<HEAD>
</HEAD>
<BODY>

<% Exception err = new Exception();
   throw err; %>

</BODY>
</HTML>
-----

        It should compile fine, but it still doesn't work.

Dave

-----Original Message-----
From: Shawn Lohstroh [mailto:[EMAIL PROTECTED]]
Sent: 12 October 1999 19:30
To: Dave Townsend; [EMAIL PROTECTED]
Subject: Re: Errorpage directive


Dave,
The errorPage directive is a runtime directive, not a compile time
directive. If an exception occurs during execution of the page, the
errorPage will be called. If an error occurs during compilation of your JSP
page, it is up to your JSP engine to report the error.

-Shawn


----- Original Message -----
From: Dave Townsend <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 12, 1999 12:44 PM
Subject: Errorpage directive


>         Perhaps someone can explain what is going wrong here.
>
>         I'm trying to get an error page to work, here is the first page I
call:
>
> -----
> <%@ page language="java" errorPage="error.jsp" %>
>
> <% bad script; %>
> -----
>
> Obviousley this fails to compile, so the errorpage referenced should be
> called:
>
> -----
> <%@ page language="java" isErrorPage="true" %>
>
> <HTML>
> <HEAD>
> <TITLE>Error Page</TITLE>
> </HEAD>
> <BODY>
> An error occured
> </BODY>
> </HTML>
> -----
>
> Which does nothing, just explains what happenned. But this doesn't happen
> the JSWDK just reports that it could not compile the page and suggests
that
> I should try using an errorpage to explain this problem.
>
> Why doesn't this work?
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to