HomeJava & J2EE Page 2 - The JSP Files (part 7): Bugs, Beans And Banks
Bugathon - Java
In this week's episode, find out how the JSP Exception objectprovides developers with a graceful way to recover from script errors. Andthen take a quick tour of the JSP directives you need to know in order tointegrate standalone JavaBeans into your JSP scripts.
First, though, a quick lesson in semantics. There's an important distinction to be aware of between "errors" and "exceptions".
JSP "errors" cannot usually be trapped, as they usually involve problems beyond the application developer's control - things like the server running out of memory, missing files or a corrupted filesystem.
The term "exceptions", on the other hand, refers to those errors which can be tracked and controlled. For example, if an argument provided to a function is incorrect, JSP will "throw" an "invalid argument" exception, together with a stack trace or detailed explanation of the problem. Exceptions like these can be "caught" by the application, and appropriately diverted to an exception-handling routine.
Since JSP shares much in common with Java, it won't surprise you to learn that JSP's concept of exceptions is derived almost entirely from Java. In Java, an exception is an instance of an object; in JSP, an implicit Exception object is available to identify and manage exceptions.