我是靠谱客的博主 要减肥啤酒,这篇文章主要介绍JSP errorPage设置方法,现在分享给大家,希望可以做个参考。

1.设置errorPage:errorPage.jsp

复制代码 代码如下:

<%@page isErrorPage="true"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
Error~!
<%=exception.getMessage()%>
</body>
</html>

2.应用
复制代码 代码如下:

<%@page info="Bad page"%>
<%@page errorPage="errorPage.jsp" %> //出错后转到
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
boolean tf = true;
if(tf){
String info = getServletInfo();
throw new Exception("Exception in:" + info);
}
%>
</body>
</html>

最后

以上就是要减肥啤酒最近收集整理的关于JSP errorPage设置方法的全部内容,更多相关JSP内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(223)

评论列表共有 0 条评论

立即
投稿
返回
顶部