catch标签的作用类似于java中的try-catch
catch标签中的代码块如果发生异常,那么catch标签就能捕获它,并将异常信息保存在var属性所指的变量中
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<c:catch var="ex">
<%
int a = 3 / 0;
%>
</c:catch>
<c:if test="${ex != null}" >
${ex} <br/>
${ex.message} <br/>
</c:if>
</body>
</html>