If the failure occurs while a jsp is accessing the package as a bean, I believe you can use
Code:
<%= exception.getMessage() %>
To get this to work, however, you have to know that an error occurred in the jsp page. You can use a page directive to identify an errorpage that the code branches to if it hits an error, and then from the errorpage, you can display the exception message. Note: isErrorPage="true" allows the page to access the "exception" object from the prior jsp page.
Code:
<%@ page errorPage="errorpage.jsp" %> //in original jsp file
...
//Contents of errorpage.jsp
<%@ page isErrorPage="true" %>
<html>
<body>
The following was an exception generated by....
<blockquote>
<%= exception.getMessage() %>
</blockquote>
</body>
</html>
This comes more or less from O'Reilly's "JavaServer Pages" book. Good stuff.