예:
<%!
String getFormattedDate() {
...
throw new IllegalArgumentException(...); // 오류
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello, JSP!</title>
</head>
<body>
<i>Today is <%= getFormattedDate() %></i>
</body>
</html>
참고: 서블릿 컨테이너가 모든 JSP 코드를 try {} catch() {} 블록으로 래핑하기 때문에 그러한 JSP 페이지는 컴파일되지만 서버에 배포 시 런타임 예외가 발생합니다.