#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    13
    Rep Power
    0

    How do I incorporate my error message jsp...


    Hi guys,

    I'm very very new to JSP so please bear with me. I have a small .jsp file that displays a custom error page instead of the usual 404 500 type of server errors. What I am trying to figure out is how to incorporate it (call it) from say a main .jsp file....

    Here is my error handling .jsp:


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional??EN">
    <%@page errorPage="show_error_page.jsp" %>
    <%@page import= "java.util.Date" %>
    <%-- Written by Mike 6/11/03 --%>

    <html>
    <head><title>EMail List Application</title></head>

    <body>
    <%@ page isErrorPage="true" %>
    <h1>Page Error</h1>
    <p>There was a problem in adding your email to the list.
    Please try again at a later time></p>
    <p><i><%= exception %></i></p>

    Today's date is <%= new Date() %> <br>

    </body>
    </html>



    How would I "call" this when an error occurs in my main .jsp file


    thanks very much

    Mike
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Cambs, UK
    Posts
    68
    Rep Power
    13
    You've made a small mistake. One your errorpage you should have something like <%@ page isErrorPage="true" %>, not <%@page errorPage="show_error_page.jsp" %>.

    The <%@ page errorPage="show_error_page.jsp" %> line should go on your main.jsp. Then when an exception is thrown, show_error_page.jsp will be shown.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    13
    Rep Power
    0
    Thanks very much............... will change it and give another shot


    Mike
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Location
    Cambs, UK
    Posts
    68
    Rep Power
    13
    If it doesn't work, let me know. I can always post a couple of example pages if it helps.

IMN logo majestic logo threadwatch logo seochat tools logo