March 2, 2011

JSTL 1.1 - <c:catch> example


<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:catch var="ex" >
   <% int j=3/0; %>
</c:catch>
<c:out value="${ex.message}" />

prints,

/ by zero

2 comments:

  1. Dinesh,
    You told us to use EL and JSTL instead of scripting elements. Can you modify current examples so that they don't use scripting elements? This would provide a separation between EL/JSTL and scripting elements.

    ReplyDelete
  2. These examples are designed to quickly teach the JSTL tags. To completely avoid scripting elements would entail writing a full-fledged web application with an MVC architecture.

    ReplyDelete