Chapter 8. Handling Errors

Today you'll see how to handle the case when things don't go as planned. Errors are a fact of life for most programmers (perhaps not for you if you write perfect code, but for most programmers!) and both Java and JSP offer you a number of ways of dealing with them. There are two main kinds of errors—syntax and runtime, and you'll see how to handle both of them today:

  • Syntax errors are just what they sound like—errors in Java and JSP syntax. These are handled before your application is even released.

  • Runtime errors are harder to deal with. Here, your application is fine as far as syntax goes, but there is some problem with the code's logic, and an error occurs as the user is running your application.

Because you handle syntax ...

Get Sams Teach Yourself JavaServer Pages™ in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.