tag
Syntax format
...
property
| property | Description | Whether it is required | Default value |
|---|---|---|---|
| var | The variable used to store the error information | No | None |
Example Demonstration
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
c:catch 标签实例
<% int x = 5/0;%>
异常为 : ${catchException}
发生了异常: ${catchException.message}
The result of the above example:
异常为 : java.lang.ArithmeticException: / by zero
发生了异常: / by zero
JSP Standard Tag Library