We can use JSTL Core tags c:catch and c:if to catch exception inside the JSP service method and process it. c:catch tag catches the exception and wraps it into the exception variable and we can use c:if condition tag to process it. Below code snippet provide sample usage.
<c:catch var ="exception"> <% int x = 5/0;%></c:catch> <c:if test = "${exception ne null}"> <p>Exception is : ${exception} <br /> Exception Message: ${exception.message}</p></c:if>
No comments:
Post a Comment