Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

tag

tag

JSP Standard Label LibraryJSP Standard Tag Library

The tag is mainly used to handle exceptional conditions that produce errors and to store the error information.

Syntax format





...



property

The tag has the following attributes:

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 Label LibraryJSP Standard Tag Library