aspose file tools
The moose likes JSF and the fly likes Printing Exception's stacktrace Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Printing Exception Watch "Printing Exception New topic
Author

Printing Exception's stacktrace

francesco raccuglia
Greenhorn

Joined: Jul 04, 2008
Posts: 2
Hi,

how can I print an exception's stacktrace with a JSFcomponent.

Actually i'm printing the exception message with a



It is working but i can't format the stacktrace like normally is done in a console.

Thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14460
    
    7

Actually, there's not a whole lot of good reasons to display a stacktrace on a web page. Users can't read them, can't understand them, and don't like them. Technically-savvy people can obtain all sorts of information about what's inside the webapp, and perhaps then exploit it for evil purposes. You're better off outputting the stacktrace to a logfile. Most loggers, in fact, have a log method that can be passed the exception and the exception's stack trace will then appear in the log.

Frameworks such as Facelets can display stack information - and a whole lot more. Although, again, it's not something you really want users to see, so employ if for development, but intercept and handle the exceptions before going to production.

If, for purely academic reasons, you would like to use JSF to display a stack trace, the easiest method would be do render a datatable with a DataModel that enumerated each of the levels of the stack trace.


Customer surveys are for companies who didn't pay proper attention to begin with.
francesco raccuglia
Greenhorn

Joined: Jul 04, 2008
Posts: 2
hi Tim , thanks for the answer.

 
I agree. Here's the link: jrebel
 
subject: Printing Exception's stacktrace
 
Similar Threads
Response already committed
split string doesn't work
JSF 2.0 exception handling - Is it necessary to catch the exceptions in the Bean classes ?
ensuring exceptions are immutable
What is serialized???