This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Dear All, I'd like to have a page that display some business exception (eg. InsufficientFundException) with the possibility of displaying the stack trace of the business exception as well when clicking on a link (say for example). Say, the business exception (eg. InsufficientFundException) occurred and a page saying Insufficient Fund was displayed. There is a link at the bottom saying "click to display details" which would print out the exception stack trace. Is this possible? has anyone done this before? thanks for the help guys Ras
Joined: Jul 20, 2002
Dear William, Thanks for the reply. Could you explain further please? Prefereably with some code sample. Thanks a lot. With Regards, Ras
We either show the stack trace or we don't. ie internal pages display the stack trace on the page, external (internet) page do not. Personally I say that if you are going to show the exception, show it. Don't make it a 2 step process to get there. Dave
Joined: Jul 20, 2002
Hi David, Can you explain a bit more about the internal pages and external pages you mentioned? Why would a web site need both pages? Thanks for the explanation in advance. Is there a way to make the two step process comes true? Thanks again
By internal and External I'm referring to pages viewed over the internet and pages that are only for internal, company use. When we build a web-app that has an administration component, we print the stack trace on the internal admin pages, but never provide the stack trace to the outside world. If you want to provide the stack trace in a two step process:
when the exception is detected, put it on the session and redirect to the error page.
if the user hits the button, call the page with an extra parameter.
when the parameter is detected, load the Exception from the session and display it
The reason I don't like doing things like this is that you are using the session to support request-scope data. The exception remains on the session even though it might never be used again by the user. You can't remove the exception in case they reload the page. Anyway, hope this helps. Dave