Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with JSP Tag library

Status
Not open for further replies.

boske3

Programmer
Mar 11, 2006
20
RS
Hi !
I have one problem .I tried to make two jsp files with
which i tried to make a little test for
my error page.I make one page named useErrorPage.jsp and
it looks like this:

<%@page errorPage="errorPage.jsp" %>
<%@taglib uri=" prefix="c"%>
<%@taglib uri=" prefix="fmt"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>

<fmt:parseDate value="A midsummer night"/>

</body>
</html>

with this page i tried to make error on page by putting
a string against number in parseDate value, and
another page tried to catch this error.The second
page looks like this:

<%@page isErrorPage="true" %>
<%@taglib uri=" prefix="c"%>
<%@taglib uri=" prefix="fmt"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>

<h1>JSP Page</h1>


<h4>Error!</h4>
<p>Something bad happened in one of your pages:</p>
<p><c:eek:ut value="${pageContext.exception.message}"/></p>

</body>
</html>

All i can get wen i call useErrorPage.jsp is 500 Html error
and not error page that i expect.
Can eanyone help me!or have another idea for fast testing
error page on this way.
 
Well you need to tell Tomcat (or other servlet container) that it should use your custom error page - else how would it know ?

In your webapp's web.xml, you need to add something like :

Code:
    <error-page>
        <error-code>500</error-code>
        <location>/error500.jsp</location>
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/error404.jsp</location>
    </error-page>



--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top