Java Reference
In-Depth Information
Give these classes empty constructor bodies, defi ne the
toString
method for
each to return a meaningful error message and place the classes in a package
called
errorExceptions
. Create a subdirectory of
classes
called
errorExceptions
and save these
Exception
classes (at least the
.class
fi les) into this directory.
(ii) Modify the JSP of the preceding exercise so that it imports package
errorExceptions
and throws an object of one of the three
Exception
classes just
defi ned, according to whether the fi rst operand, the second operand or both is/
are non-numeric. (This involves some interesting logic that includes nested
try
blocks.) If you are going to change the name of your error page (which
will require modifi cation, as noted below), remember to change its name in this
JSP's
page
directive.
(iii) Modify the associated JSP error page so that it makes use of the
toString
method of the implicit
exception
object (if it didn't already do so) and allows
return to the correct JSP.
Search WWH ::
Custom Search