展会信息港展会大全

jsp中error page设置方法
来源:互联网   发布日期:2016-03-01 10:56:25   浏览:2113次  

导读:1.设置errorPage:errorPage.jsp %@page isErrorPage=true% html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleJSP Page/title /head body Error~! %=exception.getMessage()% /body /html 2.应用 %@page info=Bad page% %@pag...

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>

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港