Lir

JSP Exception

Lir
Mar 1st, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. //Показано как в JSP словить exeption и как взять объект исключения потом
  2. <%@ taglib prefi x=”c” uri=”http://java.sun.com/jsp/jstl/core” %>
  3. <%@ page errorPage=”errorPage.jsp%>
  4. <html><body>
  5.     About to do a risky thing: <br>
  6.     <c:catch var=”myException”>
  7.     Inside the catch...
  8.         <% int x = 10/0; %>
  9.     </c:catch>
  10.     <c:if test=”${myException != null}>
  11.         There was an exception: ${myException.message} <br>
  12.     </c:if>
  13.     We survived.
  14. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment