jsp的出错处理

以下页面将产生一个例外:

1@ page errorPage="errorpge.jsp" 
1<html>
2<head>
3<title>JSP 1.0 Error Page Demo</title>
4</head>
5<body>
6<h1>JSP 1.0 Error Page Demo</h1>   

String s = null;
s.getBytes(); //这将给出 NullPointException例外

1</body>
2</html>

在出错后以下页面被调用:

1<html>
2<body bgcolor="black" text="#FFFFFF">   

--@ page isErrorPage="true" --

1<h1> Attenion the fellowing error occurs</h1><br/>
2<pre>```
3= exception.getMessage() 
4```</pre>
5</body>
6</html>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus