JSP Exception Handling Flashcards
1
Q
3 Types of Exceptions in JSP
A
- checked exception
- runtime exception
- error exception
2
Q
Checked Exceptions
A
It is an exception that is typically a user error or a problem that cannot be foreseen by the programmer.
Examples:
- FileNotFoundException
- IOException
- SQLException when there is an issue with the connectivity of the SQL database
3
Q
Runtime Exceptions
A
They are the ones that could have been avoided by the programmer. They are ignored at the time of compilation.
Examples:
- ArrayIndexOutOfBoundsException
- ArithmeticException
- NullPointer Exception
4
Q
Error Exceptions
A
They are the instances of the throwable class, and they are used in error pages.
5
Q
How to handle exceptions in JSP code?
A
- use exception object
- use JSTL tags for an error page
- use Try…Catch Block