jsp中error page设置方法

2016-02-19 13:19 14 1 收藏

下面图老师小编要向大家介绍下jsp中error page设置方法,看起来复杂实则是简单的,掌握好技巧就OK,喜欢就赶紧收藏起来吧!

【 tulaoshi.com - Web开发 】

  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

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)

  2.应用

  %@page info="Bad page"%

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)

  %@page errorPage="errorPage.jsp" % //出错后转到

  html

  head

  meta http-equiv="Content-Type" content="text/html; charset=UTF-8"

  titleJSP Page/title

  /head

  body

  %

  boolean tf = true;

  if(tf){

  String info = getServletInfo();

  throw new Exception("Exception in:" + info);

  }

  %

  /body

  /html

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/webkaifa/)

来源:https://www.tulaoshi.com/n/20160219/1603798.html

延伸阅读
标签: Java JAVA基础
    作者:danielmouse     由于朋友问起我开发JSP前都要做些什么,就写了这篇东东。   如果有高手误进,请指正,不要扁我喔!:)   前期准备软件:   j2sdk-1_4_0_01-windows-i586.exe   -----JSDK JAVA开发工具包   jakarta-tomcat-5.0.18.zip   -----TOMCAT5 服务器...
标签: Web开发
今天在网上看到ASP.Net 2.0中注册自定义控件的好方法,记录如下。 在web.config 文件中全局注册自定义控件 system.web       pages         controls           add tagPrefix="rx" assembly="HYLQ.Component" ...
foo (a) { if (a 0) return a; } Spurious warnings can occur because GNU CC does not realize that certain functions (including abort and longjmp) will never return. * An eXPression-statement or the left-hand side of a comma expression contains no side effects. To su...
标签: Java JAVA基础
  为了简化JSP表达式和scriptlets中的代码,提供了8种自动定义的变量,有时称做implicit objects(固有对象)。它们是:request,response,out,session,application,config,pageContext,和 page。下面我们来详细的了解它们。 request 与request相联系的是HttpServletRequest类,使您可以得到request的参数(通过getParameter方法...
标签: Web开发
page对象代表JSP本身,更准确地说它代表JSP被转译后的Servlet,它可以调用Servlet类所定义的方法。 二、config 对象 config 对象里存放着一些Servlet 初始的数据结构。 config 对象实现于javax.servlet.ServletConfig 接口,它共有下列四种方法: public String getInitParameter(name) public java.util.Enumera...

经验教程

884

收藏

96
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部