This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes <error-page> tag mechanism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "<error-page> tag mechanism" Watch "<error-page> tag mechanism" New topic
Author

<error-page> tag mechanism

Kamila Rutkowski
Ranch Hand

Joined: Sep 22, 2009
Posts: 37
I put this tag in web.xml:


but when the error occurs my browser doesn't show errormessage.jsp! instead I see this message:

The website cannot display the page
HTTP 500
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

As this is not Tomcat-specific, it's been moved to the Servlets forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

what is present inside errormessage.jsp ??


Save India From Corruption - Anna Hazare.
Kamila Rutkowski
Ranch Hand

Joined: Sep 22, 2009
Posts: 37
Ravi Kiran Va wrote:what is present inside errormessage.jsp ??



<%@ page isErrorPage="true"%>
<html>
<head></head>
<body>
An error has occurred.
</body>
</html>
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Try to use <error-code>.


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

Two things!

1. Have you tried putting this code in your jsp throwing any subclass of Throwable?


2. Have you checked if the page not displayed due to some kind of Error which is not a sub-class of Throwable?

Try to use <error-code>.

You don't need to necessarily use errorcode, errorpage should work.

Cheers,
Naren
---------------------------------
SCJP
SCDJWS
SCWCD

Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Kamila Rutkowski
Ranch Hand

Joined: Sep 22, 2009
Posts: 37
The Error is a sub-class of Throwable. I don't want to use because my project is JSF based on Facelets.

Naren Chivukula wrote:Two things!

1. Have you tried putting this code in your jsp throwing any subclass of Throwable?


2. Have you checked if the page not displayed due to some kind of Error which is not a sub-class of Throwable?

Try to use <error-code>.

You don't need to necessarily use errorcode, errorpage should work.

Cheers,
Naren
---------------------------------
SCJP
SCDJWS
SCWCD
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

I think, we should specify 3 things.

1) In web.xml, the DD
2) isErrorPage attribute of page directive of the error jsp/html.
3) setting the errorPage attribute of the page directive of the jsp with corresponding error page.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: <error-page> tag mechanism
 
Similar Threads
Exception redirect to page
welcome-file-list
Error Page Problem
Error Page
How to handle JSP exceptions declaratively