熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

jsp中error page設置方法

2022-06-13   來源: JSP教程 

  設置errorPageerrorPagejsp

  <%@page isErrorPage=true%>

  <html>

  <head>

  <meta httpequiv=ContentType content=text/html; charset=UTF>

  <title>JSP Page</title>

  </head>

  <body>

  Error~!

  <%=exceptiongetMessage()%>

  </body>

  </html>

  應用

  <%@page info=Bad page%>

  <%@page errorPage=errorPagejsp %> //出錯後轉到

  <html>

  <head>

  <meta httpequiv=ContentType content=text/html; charset=UTF>

  <title>JSP Page</title>

  </head>

  <body>

  <%

  boolean tf = true;

  if(tf){

  String info = getServletInfo();

  throw new Exception(Exception in: + info);

  }

  %>

  </body>

  </html>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20524.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.