JSP Exception Handling Flashcards

1
Q

3 Types of Exceptions in JSP

A
  • checked exception
  • runtime exception
  • error exception
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Error Exceptions

A

They are the instances of the throwable class, and they are used in error pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How to handle exceptions in JSP code?

A
  • use exception object
  • use JSTL tags for an error page
  • use Try…Catch Block
How well did you know this?
1
Not at all
2
3
4
5
Perfectly