Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to show the actual Exception occured during JSP Excution in Error Pages using JSP

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am retrieving the Data from Data Base into my JSP , inside jsp , while Iterating through the Obtained Data , when a particular condition is not met , i am manually throwing a Exception inside jsp catch block .

For example :



Inside web.xml settings , i am showing a Particular page to indicate a Error on to processing this way

Inside web.xml we ahve :


Please let me know how can i show the actual exception that is "Query Execution Failed" inside this displayed ErrorPage.jsp

Please help , thanks in advance .



 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying .

I know about the errorPage and the isErrorPage attributes of Page directive , how can this help me in my question .

Will it work if i set the Error under request scope and access that under the ErrorPage.jsp ??

Need your help .
 
Ankit Garg
Sheriff
Posts: 9593
34
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In an error page you get the implicit exception which represents the Exception object. You can use that like given here. The container also sets a few request attributes which you can display using EL. Some of these request attributes are (source: servlet spec)

javax.servlet.error.exception_type
javax.servlet.error.message
javax.servlet.error.exception
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankit for the reply ,

I need some clarification , you mean to say that ,
Without setting the exception Object in any of the scopes , we can getting the exception Message directly inside the ErrorPage.jsp ?
(Provided if this ErrorPage.jsp ,met with a condition as isErrorPage="true")


Please clarify , thanks in advance .

 
Ankit Garg
Sheriff
Posts: 9593
34
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to create a sample error page as given on the page that I linked and you'll know...
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I couldn't able to access the link you provided as our Firewall stops that , so the reason i have asked you for clarification .

Anyways thanks for the response .
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about this link?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was great link paul , thank you very much .
 
mooooooo ..... tiny ad ....
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!