O'Reilly logo

Web Technology: Theory and Practice by M. Srinivasan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.11 JSP EXCEPTIONS

Exceptions in JSP can be handled by a special page. There is an object called Exception which is set by the container (only on the JSP Exception page). The JSP Exception page is marked by a directive as shown below.

<%@page isErrorPage=“true” %>

An example will make it clear. Consider a Form which accepts a PIN value as the password. The HTML is shown in Figure 6.6.

 

A sample index.jsp with exception through JSP

 

 

Fig. 6.6 A sample index.jsp with exception through JSP

 

Index.jsp captures the form data and hands it over to validateAndShow.jsp. The code shown in Figure 6.7 is written in a way to experiment with invalid data. In this case a non-numeric data on the PIN ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required