June 2012
Intermediate to advanced
386 pages
10h 7m
English
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.
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 ...
Read now
Unlock full access