• Post Reply Bookmark Topic Watch Topic
  • New Topic

Customised Error Page Not shown  RSS feed

 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you declare isErrorPage directive to "true" in your JSP, you will have access to the implicit 'exception' object.
 
Rajendar Goud
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry Ben!
 
Anurag Mishra
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ page isErrorPage="true"%>. I have written this,
 
Rajendar Goud
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much, Nathan!!! I sure worked!! I am really thankful to YOU!! Thanks very much!
Good Day!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!