灯火互联
管理员
管理员
  • 注册日期2011-07-27
  • 发帖数41778
  • QQ
  • 火币41290枚
  • 粉丝1086
  • 关注100
  • 终身成就奖
  • 最爱沙发
  • 忠实会员
  • 灌水天才奖
  • 贴图大师奖
  • 原创先锋奖
  • 特殊贡献奖
  • 宣传大使奖
  • 优秀斑竹奖
  • 社区明星
阅读:3223回复:0

JSP中errorPage设置方法

楼主#
更多 发布于:2012-09-10 19:55




  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>


喜欢0 评分0
游客

返回顶部