aspose file tools
The moose likes JSP and the fly likes Customised Error Page Not shown Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Customised Error Page Not shown" Watch "Customised Error Page Not shown" New topic
Author

Customised Error Page Not shown

Anurag Mishra
Ranch Hand

Joined: Sep 27, 2001
Posts: 133
I have made a Customised error page and want to dispaly that when an error occurs. The entry of the same has been done in web.xml(Jboss3.2.5). Although it prints the System.out.println statement on Console, written on that error page but does not make the HTML page to show on Broser. Thanks for all the help
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you declare isErrorPage directive to "true" in your JSP, you will have access to the implicit 'exception' object.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
Hi Ben,
i too am using the ErrorPage in my web application and am able to display the errors using the JSP implicit object 'exception'.
when ever an error is displayed, i am catching
the
strmsg = exception.getMessage() and prints the same on the browser.

But iam not able to handle the 'session Timeout ' using this exception object.

when the session is timedout ,the browser displays 'null' .
how to trap session time out using 'exception' object.

Thanks
Raj
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Rajendar Goud,

You've highjacked anumishra1's thread.
Ask your question in a new thread and I or someone else will gladly help you.
(BTW: a session timing out is not an exception)
Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
sorry Ben!
Anurag Mishra
Ranch Hand

Joined: Sep 27, 2001
Posts: 133
I have tried to use both ways, with and without isErrorPage=true but none of them seem to work. I do not even require the JSP object, just want to print a simple message. That is it.
Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
anu,
you said u had tried with 'isErrorPage=true' ,but did you placed the statement in the jsp page from which the error had to be invoked.that page should have the entry like
<%@page errorPage="your error jsp page" %>

it should work .
Anurag Mishra
Ranch Hand

Joined: Sep 27, 2001
Posts: 133
<%@ page isErrorPage="true"%>. I have written this,
Rajendar Goud
Ranch Hand

Joined: Mar 06, 2002
Posts: 220
nope anu,
that shouldnt be 'true' but the jsp page name in which you had
declared <%@page isErrorPage="true" %>


isErrorPage="true" means that the page is going to act as a Custom Error page.

And the jsp page which is going to throw the error should contain the
declaration

<%@page errorPage="x.jsp" %>


x.jsp should have the declaration <%@page isErrorPage="true" %>
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

"anumishra1" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy. User names cannot be obviously fake and must constist of a first name and a last name.

You can change your user name here.

Thanks! and welcome to the JavaRanch!


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

By any chance, are you using IE as your web browser? IE generates it's own error pages for some response types rather than using the error page from the server. You can turn this off by choosing something like Tools->Internet Options->Advanced Tab->Show Friendly HTTP Error Messages and un-checking the check box.

Another option I have heard of is to change the HTTP Error status code to 200 - OK (response.setStatus(200)) in your error page. It stinks that you have to break standard defined HTTP codes to make things work with IE
Anurag Mishra
Ranch Hand

Joined: Sep 27, 2001
Posts: 133
Thanks very much, Nathan!!! I sure worked!! I am really thankful to YOU!! Thanks very much!
Good Day!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56168
    
  13

"anumishra1",

The request to change your display name was not merely a suggestion; it is a requirement for participation in the JavaRanch. Please change your display name accordingly prior to your next post.

Be aware that accounts with invalid display names are subject to closure.

bear
Forum bartender.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Again I take the harder line:

"anumishra1",
You have changed your display name from a valid one to an invalid one. You have 134 posts and your account will be deleted if you don't change it back immediately.

thanks,
Dave
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Customised Error Page Not shown
 
Similar Threads
custom error page
request.getRemoteUser() Problem
Customised Error page in case of exception in application server
customize the pages in liferay
doubt in session