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. brew 中的时间格式转换

    char * pACNowStr = NULL; JulianType jtNow; ISHELL_GetJulianDate(pIShell, , &jtNow); pACNowStr = ...

  2. DUBBO功能使用说明

    DUBBO功能使用说明 1 DUBBO概述 DUBBO是阿里巴巴公司的一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案. 相比于其他服务框架,DUBBO有如 ...

  3. ios开发之--UICollectionView的使用

    最近项目中需要实现一种布局,需要用到UICollectionView,特在此整理记录下! 贴上最终实现的效果图: 1,声明 @interface FirstViewController ()<U ...

  4. Python 进阶(一)函数式编程

    来自慕课网: 简介: 函数:function ,在入门课程已学 函数式:functional,一种编程范式 函数式编程是一种抽象计算的编程模式,函数≠函数式,好比:计算≠计算机

  5. [转载]会引起全表扫描的几种SQL

    查询语句的时候尽量避免全表扫描,使用全扫描,索引扫描!会引起全表扫描的几种SQL如下 1.模糊查询效率很低: 原因:like本身效率就比较低,应该尽量避免查询条件使用like:对于like ‘%... ...

  6. unable to execute dex:GC overhead limit exceeded unable to execute dex:java heap space 解决方案

    最近做厂商适配,厂商提供了一部分Framework的jar包,把jar包通过Add Jar放到Build Path中, 在生成APK过程中,Eclipse长时间停留在100%那个进度. 最后Eclip ...

  7. Vitamio与FFmpeg、LGPL、GPL的关系

    转自:http://sun.sanniang.me/2014/04/26/the-relationship-vitamio-with-ffmepg-lgp-gpl Vitamio 使用了 FFmpeg ...

  8. Android中开发习惯

    我觉得首先是命名规范.命名规范这种东西每个人都有自己的风格,Google 也有自己的一套规范(多看看 Android 系统源码就明白了).好的规范可以有效地提高代码的可读性,对于将来接手代码的小伙伴也 ...

  9. c/c++设置图片为透明图

    在绘制图片的时候先把源位图填充背景设置为白色 例如:m_bufferpicture.FillSolidRect(0,0,m_nWidth,m_nHeight,RGB(255,255,255));//这 ...

  10. PyQt4将窗口放在屏幕中间

    以下脚本显示了将窗口放在屏幕中间位置的方法. #!/usr/bin/python # -*- coding:utf-8 -*- import sys from PyQt4 import QtGui c ...