Handling Exceptional Conditions

Had the user entered an invalid year, a sight equivalent to the "blue screen of death" would flash before the user's eyes. Figure 3.5 displays the output in the browser had the user entered "aaaa" for the year:

Figure 3.5 shows an exception that occurred in the JSP indicating that the parseInt method couldn't parse the data. The exception is propagated to the user in case there are no error-handling routines. Such sights could rattle visitors to your site or users of your application, so much so that that they might never visit it again.

Figure 3.5. A Runtime Exception propagated to the browser

There are different ...

Get Java Server Pages from scratch 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.