Chapter 5. Servlet Exceptions

OBJECTIVES

Servicing requests from users on the Web means you will sometimes receive bad information. Also, you may make a mistake in your code. How do you handle these conditions in servlets? This chapter discusses error and exception handling.

There are two categories of problems you will face. One is from Java itself and your code. For example, you may try to write a note to the log file, but that file is locked at the moment so the write attempt fails. That will throw an exception. The other category regards the user's request, where you might get a corrupt or incomplete request. These error codes that you will work with are based on the Hypertext Transfer Protocol (HTTP).

The main focus of this chapter is servlet ...

Get Sun™ Certification Training Guide (310-080): Java™ 2 Enterprise Edition (J2EE™) Web Component Developer Exam 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.