当前位置: 移动技术网 > IT编程>开发语言>Java > JSP errorPage设置方法

JSP errorPage设置方法

2017年12月12日  | 移动技术网IT编程  | 我要评论

阎罗王重生光明法师,恋老 社区门户,辽宁旅游政务网

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>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网