JSP里web.xml实现错误处理页面的制作404,和500

时间:2010-01-26 08:30:29  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:sp;  <location>/building.jsp</location>   </error-page>   <error-page>           <error-code>500</error-code>           <location>/error.jsp</location>   </error-pa...
  正文:

web.xml文件增加如下代码查看复制到剪切板打印
<error-page>  
        <error-code>404</error-code>  
        <location>/building.jsp</location>  
</error-page>  
<error-page>  
        <error-code>500</error-code>  
        <location>/error.jsp</location>  
</error-page> 

        <error-page>
                <error-code>404</error-code>
                <location>/building.jsp</location>
        </error-page>
        <error-page>
                <error-code>500</error-code>
                <location>/error.jsp</location>
        </error-page>building.jsp查看复制到剪切板打印
<%@ page language="java" contentType="text/html; charset=GBK" isErrorPage="true" pageEncoding="GBK"%>  
<%  
  response.setStatus(Httphotoshop/ target=_blank class=infotextkey>pservletResponse.SC_OK);  
%>  
对不起,您请求的页面没有找到! 

<%@ page language="java" contentType="text/html; charset=GBK" isErrorPage="true" pageEncoding="GBK"%>
<%
  response.setStatus(HttpServletResponse.SC_OK);
%>
对不起,您请求的页面没有找到!error.jsp查看复制到剪切板打印
<%@ page language="java" contentType="text/html; charset=GBK" isErrorPage="true" pageEncoding="GBK"%>  
<%@ page import="java.io.*,java.util.*"%>  
<%response.setStatus(HttpServletResponse.SC_OK);  
 
      %>  
<body>  
程序发生了错误,有可能该页面正在调试或者是设计上的缺陷.  
 
你可以选择  
 <a href=<%=request.getContextPath()+"/forum/new.jsp" %>>反馈</a>  
提醒我... 或者  
<a href="JavaScript:history.go(-1)">返回上一页</a>  
<hr width=80%>  
<h2><font color=#DB1260>JSP Error Page</font></h2>  
 
<p>An exception was thrown: <b> <%=exception.getClass()%>:<%=exception.getMessage()%></b></p>  
<%  
System.out.println("Header....");  
Enumeration<String> e = request.getHeaderNames();  
String key;  
while(e.hasMoreElements()){  
  key = e.nextElement();  
  System.out.println(key+"="+request.getHeader(key));  
}  
System.out.println("Attribute....");  
e = request.getAttributeNames();  
while(e.hasMoreElements()){  
  key = e.nextElement();  
  System.out.println(key+"="+request.getAttribute(key));  
}  
 
System.out.println("arameter....");  
e = request.getParameterNames();  
while(e.hasMoreElements()){  
  key = e.nextElement();  
  System.out.println(key+"="+request.getParameter(key));  
}  
%>  
111<%=request.getAttribute("javax.servlet.forward.request_uri") %>   "JSP里web.xml实现错误处理页面的制作404,和500"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/JSP/12375.html


关键字:

关于《JSP里web.xml实现错误处理页面的制作404,和500》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td