---
title: "tomcat中如何禁止列目录下的文件，404出错页"
author: "fuyangchang"
date: "2007-06-23T11:57:00Z"
tags: []
slug: "tomcat-404"
draft: false
lastmod: "2007-06-23T11:57:00Z"
id: 104072
url: "https://csdn.iteye.com/blog/104072"
---

1\. tomcat中如何禁止列目录下的文件  
在{tomcat\_home}/conf/web.xml中，把listings参数设置成false即可.  
       2.自定义404出错页  
在WEB-INF/.xml文件的结尾添加如下:

![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif) &lt;error-page&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif) &lt;error-code&gt; 404 &lt;/error-code&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif) &lt;location&gt; /index.jsp&lt;/location&gt;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif) &lt;/error-page&gt;