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. CSS3给页面打标签

    我们经常会在页面的左上角或者右上角看到类似如图所示的标签,比如页面的链接(最常使用)等,下面我们就实现一个简单的标签 实现步骤是先做一个水平长条,使用CSS3的transform来实现旋转,如果是在左 ...

  2. Android NDK开发-2-环境搭建

    1.环境变量配置NDK 2.选中项目,右键属性菜单,创建一个新的编译器

  3. redis客户端使用密码

    ./redis-cli  -h 127.0.0.1 -p 6379 -a password

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

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

  5. Android储存

    Android储存一共5种方法 一: 手机内置,外部储存 1.获取本地存储 (Android的读写文件及权限设置) getFilesDir()   data/data/包名/File getCache ...

  6. <linux系统c语言生成.so文件,生成64位可执行文件,在64位系统中运行32位的可执行文件>

    1.linux 系统c语言生成.o文件,---->gcc -m64 -c -fPIC test.c -o test.o2.linux 系统c语言生成.so文件,----->gcc -sha ...

  7. C++中的字节对齐分析

    struct A { int a; char b; short c; }; struct B { char a; int b; short c; }; #pragma pack(2) struct C ...

  8. EditPlus详解

    如何让EditPlus支持LUA教程是本文要介绍的内容,这次主要介绍一下学习Lua之前的准备工作.关于在EditPlus中实现lua的安装,具体内容来看本文详解. (1) 下载Lua安装包,最新版本是 ...

  9. Parquet存储格式 - 论文翻译【转】

    Apache Parquet是Hadoop生态圈中一种新型列式存储格式,它可以兼容Hadoop生态圈中大多数计算框架(Mapreduce.Spark等),被多种查询引擎支持(Hive.Impala.D ...

  10. x86 体系指令

    FASM 第二章 - 2.1 x86 体系指令 Author: 徐艺波  From: xuyibo.org  Updated: 2008-04-17   官方论坛   本站软件反馈.软件开发交流.   ...