Tomcat是直接显示目录结构和文件列表,只是在配置里面给关闭了。 
关键在这里:\conf\web.xml

这个文件有一段配置直接控制Tomcat是允许显示目录结构和文件列表。

  1. <servlet>
  2. <servlet-name>default</servlet-name>
  3. <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
  4. <init-param>
  5. <param-name>debug</param-name>
  6. <param-value>0</param-value>
  7. </init-param>
  8. <init-param>
  9. <param-name>listings</param-name>
  10. <param-value>false</param-value>
  11. </init-param>
  12. <load-on-startup>1</load-on-startup>
  13. </servlet>

把listings选项改为true就可以了。 另外把<welcome-file>的配置去掉

例子

org.apache.catalina.servlets.DefaultServlet支持许多配置选项,在这个web.xml文件里面都有注释。

    1. <!-- The default servlet for all web applications, that serves static     -->
    2. <!-- resources.  It processes all requests that are not mapped to other   -->
    3. <!-- servlets with servlet mappings (defined either here or in your own   -->
    4. <!-- web.xml file.  This servlet supports the following initialization    -->
    5. <!-- parameters (default values are in square brackets):                  -->
    6. <!--                                                                      -->
    7. <!--   debug               Debugging detail level for messages logged     -->
    8. <!--                       by this servlet.  [0]                          -->
    9. <!--                                                                      -->
    10. <!--   fileEncoding        Encoding to be used to read static resources   -->
    11. <!--                       [platform default]                             -->
    12. <!--                                                                      -->
    13. <!--   input               Input buffer size (in bytes) when reading      -->
    14. <!--                       resources to be served.  [2048]                -->
    15. <!--                                                                      -->
    16. <!--   listings            Should directory listings be produced if there -->
    17. <!--                       is no welcome file in this directory?  [false] -->
    18. <!--                       WARNING: Listings for directories with many    -->
    19. <!--                       entries can be slow and may consume            -->
    20. <!--                       significant proportions of server resources.   -->
    21. <!--                                                                      -->
    22. <!--   output              Output buffer size (in bytes) when writing     -->
    23. <!--                       resources to be served.  [2048]                -->
    24. <!--                                                                      -->
    25. <!--   readonly            Is this context "read only", so HTTP           -->
    26. <!--                       commands like PUT and DELETE are               -->
    27. <!--                       rejected?  [true]                              -->
    28. <!--                                                                      -->
    29. <!--   readmeFile          File name to display with the directory        -->
    30. <!--                       contents. [null]                               -->
    31. <!--                                                                      -->
    32. <!--   sendfileSize        If the connector used supports sendfile, this  -->
    33. <!--                       represents the minimal file size in KB for     -->
    34. <!--                       which sendfile will be used. Use a negative    -->
    35. <!--                       value to always disable sendfile.  [48]        -->
    36. <!--                                                                      -->
    37. <!--   useAcceptRanges     Should the Accept-Ranges header be included    -->
    38. <!--                       in responses where appropriate? [true]         -->
    39. <!--                                                                      -->
    40. <!--  For directory listing customization. Checks localXsltFile, then     -->
    41. <!--  globalXsltFile, then defaults to original behavior.                 -->
    42. <!--                                                                      -->
    43. <!--   localXsltFile       Make directory listings an XML doc and         -->
    44. <!--                       pass the result to this style sheet residing   -->
    45. <!--                       in that directory. This overrides              -->
    46. <!--                        globalXsltFile[null]                          -->
    47. <!--                                                                      -->
    48. <!--   globalXsltFile      Site wide configuration version of             -->
    49. <!--                       localXsltFile This argument is expected        -->
    50. <!--                       to be a physical file. [null]                  -->
    51. <!--                                                                      -->
    52. <!--

配置Tomcat直接显示目录结构和文件列表的更多相关文章

  1. IntelliJ和tomcat中的目录结构

    IntelliJ和tomcat中的目录结构   IntelliJ的官网帮助中心:http://www.jetbrains.com/idea/webhelp/getting-help.html   pr ...

  2. (大数据工程师学习路径)第一步 Linux 基础入门----目录结构及文件基本操作

    Linux 目录结构及文件基本操作 介绍 1.Linux 的文件组织目录结构. 2.相对路径和绝对路径. 3.对文件的移动.复制.重命名.编辑等操作. 一.Linux 目录结构 在讲 Linux 目录 ...

  3. 第三百九十四节,Django+Xadmin打造上线标准的在线教育平台—Xadmin后台进阶开发配置2,以及目录结构说明

    第三百九十四节,Django+Xadmin打造上线标准的在线教育平台—Xadmin后台进阶开发配置2,以及目录结构说明 设置后台列表页面可以直接修改字段内容 在当前APP里的adminx.py文件里的 ...

  4. Linux 目录结构及文件基本操作

    Linux 目录结构及文件基本操作 实验介绍 1.Linux 的文件组织目录结构. 2.相对路径和绝对路径. 3.对文件的移动.复制.重命名.编辑等操作. 一.Linux 目录结构 在讲 Linux ...

  5. Linux 01 Liunx目录结构及文件基本操作

    Linux目录结构及文件基本操作 1.Linux的文件组织目录结构(遵循FHS标准) FHS(Filesystem Hierarchy Standard)标准:多数Linux版本采用这种文件组织形式, ...

  6. springBoot(3)---目录结构,文件上传

    目录结构,文件上传 一.目录结构 1.目录讲解 src/main/java:存放代码      src/main/resources                   static: 存放静态文件, ...

  7. vue 目录结构与文件配置说明

    目录结构与文件配置说明 首先对目录结构进行说明, 1.build目录,主要利用webpack与node插件启动一些相关服务的js文件 2.config目录主要是针对开发环境,生产环境,测试环境的配置信 ...

  8. 实验楼学习linux第一章第四节linux目录结构及文件基本操作

    linux目录结构及文件基本操作 常用命令 切换目录 cd 当前目录 . 上一级目录 .. (.和..开头的都是隐藏文件) 查看隐藏文件 ls -a 上一级所在目录 - 当前用户home目录 ~ 获取 ...

  9. 如何使用Shell写一个显示目录结构的命令?

    公众号关注 「开源Linux」 回复「学习」,有我为您特别筛选的学习资料~ 在Linux中使用Shell写一个显示目录结构的命令,快速寻找目录结构. 1.代码 #!/usr/bin/env bash ...

随机推荐

  1. day21<IO流+&FIle递归>

    IO流(字符流FileReader) IO流(字符流FileWriter) IO流(字符流的拷贝) IO流(什么情况下使用字符流) IO流(字符流是否可以拷贝非纯文本的文件) IO流(自定义字符数组的 ...

  2. 改进动态设置query cache导致额外锁开销的问题分析及解决方法-mysql 5.5 以上版本

    改进动态设置query cache导致额外锁开销的问题分析及解决方法 关键字:dynamic switch for query cache,  lock overhead for query cach ...

  3. [直观学习排序算法] 视觉直观感受若干常用排序算法 以及 iOS 资料

    http://www.zhfish.net/?s=点击范围 1 快速排序 介绍: 快速排序是由东尼·霍尔所发展的一种排序算法.在平均状况下,排序 n 个项目要Ο(n log n)次比较.在最坏状况下则 ...

  4. SASS环境搭建及HBuilder中sass预编译配置

    ---------------------------------Ruby环境安装-------------------------------- 至于为什么要安装ruby环境请移步:https:// ...

  5. js offset

    1.offsetParent offsetParent属性返回一个对象的引用,这个对象是距离调用offsetParent的元素最近的(在包含层次中最靠近的),并且是已进行过CSS定位的容器元素. 如果 ...

  6. Minix2.0操作系统kernel文件分析

    详细分析  MINIX消息机制的核心: mpx386.s start.c proc.c 保护模式分析: src/kernel/exception.c src/kernel/protect.c src/ ...

  7. 【BZOJ4922】[Lydsy六月月赛]Karp-de-Chant Number 贪心+动态规划

    [BZOJ4922][Lydsy六月月赛]Karp-de-Chant Number Description 卡常数被称为计算机算法竞赛之中最神奇的一类数字,主要特点集中于令人捉摸不透,有时候会让水平很 ...

  8. SSL安装方法二:Windows Server 2008安装SSL证书(IIS 7.5)

    SSL证书CSR和CA证书唯一的区别就在:申请证书中的通用名称,具体还要看具体的项目这里只做参考.可以参考SSL安装方法一 背景:IIS 7.5 一.收到SSL证书 仔细阅读邮件 按步骤进行: 1)  ...

  9. Dcloud开发-- 打开蓝牙

    这样打开APP就会直接提示是否要打开蓝牙: <script type="text/javascript"> mui.init(); mui.plusReady(func ...

  10. JS--页面返回/跳转/刷新(转载)

    原文: Javascript 返回上一页1. Javascript 返回上一页 history.go(-1), 返回两个页面: history.go(-2); 2. history.back(). 3 ...