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 ...