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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.