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(HttpServletResponse.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="javascr<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.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") %>
<%=request.getAttribute("javax.servlet.forward.servlet_path") %>
<p>With the following stack trace:</p>
<pre>
<%exception.printStackTrace();
ByteArrayOutputStream ostr = new ByteArrayOutputStream();
exception.printStackTrace(new PrintStream(ostr));
out.print(ostr);
%>
</pre>
<hr width=80%>
</body>
新聞熱點
疑難解答