当前位置:首页 > JSP教程 > JSP常见问题

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>

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐