web.xml panduan penggunaan web.xml
<halaman kesalahan>
<kode kesalahan>404</kode kesalahan>
<lokasi>/building.jsp</location>
</halaman kesalahan>
<halaman kesalahan>
<kode kesalahan>500</kode kesalahan>
<lokasi>/error.jsp</lokasi>
</halaman kesalahan>
<halaman kesalahan>
<kode kesalahan>404</kode kesalahan>
<lokasi>/building.jsp</location>
</halaman kesalahan>
<halaman kesalahan>
<kode kesalahan>500</kode kesalahan>
<lokasi>/error.jsp</lokasi>
</error-page>building.jsp查看复制到剪切板打印
<%@ halaman bahasa="java" contentType="teks/html; charset=GBK" isErrorPage="true" pageEncoding="GBK"%>
<%
respon.setStatus(HttpServletResponse.SC_OK);
%>
对不起,您请求的页面没有找到!
<%@ halaman bahasa="java" contentType="teks/html; charset=GBK" isErrorPage="true" pageEncoding="GBK"%>
<%
respon.setStatus(HttpServletResponse.SC_OK);
%>
对不起,您请求的页面没有找到!error.jsp查看复制到剪切板打印
<%@ halaman bahasa="java" contentType="teks/html; charset=GBK" isErrorPage="true" pageEncoding="GBK"%>
<%@ halaman import="java.io.*,java.util.*"%>
<%response.setStatus(HttpServletResponse.SC_OK);
%>
<tubuh>
perusahaan asuransi kesehatan.
你可以选择
<a href=<%=request.getContextPath()+"/forum/new.jsp" %>>反馈</a>
提醒我... 或者
<a href="javascript:history.go(-1)">返回上一页</a>
<lebar jam=80%>
<h2><font color=#DB1260>Halaman Kesalahan JSP</font></h2>
<p>Pengecualian muncul: <b> <%=Exception.getClass()%>:<%=Exception.getMessage()%></b></p>
<%
System.out.println("Tajuk....");
Pencacahan<String> e = request.getHeaderNames();
Kunci string;
while(e.hasMoreElements()){
kunci = e.nextElement();
System.out.println(key+"="+request.getHeader(key));
}
System.out.println("Atribut....");
e = permintaan.getAttributeNames();
while(e.hasMoreElements()){
kunci = e.nextElement();
System.out.println(key+"="+request.getAttribute(key));
}
System.out.println("arameter....");
e = permintaan.getParameterNames();
while(e.hasMoreElements()){
kunci = 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>Dengan pelacakan tumpukan berikut:</p>
<pra>
<%pengecualian.printStackTrace();
ByteArrayOutputStream ostr = ByteArrayOutputStream baru();
pengecualian.printStackTrace(New PrintStream(ostr));
keluar.print(ostr);
%>
</pra>
<lebar jam=80%>
</tubuh>