Posted By:
Christopher_Koenigsberg
Posted On:
Thursday, December 19, 2002 06:56 AM
I have a special jsp, "displayerrors.jsp" which I include via "jsp:include", inside a div, at the top of each main jsp.
I have some interfaces and classes to manage some special attributes, of request and/or session scope, for error messages. Inside the beans or whatever, if an error is encountered, it calls the management API to add an error text to the error messages attribute. (the management API also logs a more detailed message, via log4j, to the sysadmins, but a less detailed message, for the end user to see, goes to the error messages attributes)
When the displayerrors jsp runs, it formats the contents, if any, of the error messages attributes, from request and session scope.
(actually in real life it is even more complicated; it also handles multiple "success messages" as well as "failure messages" so an operation could come back to display "Found that user OK" as a partial success, but then "failed to delete that user" as a failure, etc.).