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. mybatis由浅入深day02_7查询缓存_7.2一级缓存_一级缓存应用

    7 查询缓存 7.1 什么是查询缓存 mybatis提供查询缓存,用于减轻数据压力,提高数据库性能. mybaits提供一级缓存,和二级缓存. 一级缓存是SqlSession级别的缓存.在操作数据库时 ...

  2. 如何才能知道外线是FSK还是DTMF制式?

    在直线上接上来电显示话机,然后用手机或其他电话拨接电话的外线号码. 1.如果是先振铃后来显,就是FSK制式. 2.如果先送来显,再振铃或来显和振铃同时响应,就是DTMF制式 交换机默认配置是FSK制式 ...

  3. java.lang.OutOfMemoryError 错误分类

    java.lang.OutOfMemoryError: Java heap space原因:Heap内存溢出,意味着Young和Old generation的内存不够.解决:调整java启动参数 -X ...

  4. docker学习-docker安装

    win10之外的系统:https://www.docker.com/products/docker-toolbox win10系统:        https://www.docker.com/pro ...

  5. docker 配置文件:/etc/docker/daemon.json

    /etc/docker/daemon.json 是 docker 的配置文件,默认是没有的,需要我们手动创建,可配置项如下: [root@localhost ~]$ vim /etc/docker/d ...

  6. 更改嵌入式Linux中开机画面----左上角小企鹅图标

    一直想给嵌入式仪表加个开机LOGO,但是没有找到更换的方法.最近在网上收集了一些文章,整理一下一共自己参考.目前也还没有试过这种方法究竟是否可以.但察看Kernel源代码可以知道,Linux-2.6的 ...

  7. jquery ajax返回html乱码解决

    情景: index.html 使用如下代码访问另外一个html片段 1 2 3 4 5 6 7 8 9 10 11 12 13 function rewritedata(id){     var uu ...

  8. sencha touch 组件选择器getCmp和ComponentQuery.query()的效率解析

    昨天无意中在网上看到一篇讲解sencha touch组件选择器的文章,名为 Sencha touch 2通过Ext.ComponentQuery.query查找组件. 里面对组件选择器的效率讲解完全反 ...

  9. SPF难以解决邮件伪造的现状以及方案

    邮件伪造的现状 仿冒域名 私搭邮服仿冒域名: 例如某公司企业的域名是example.com,那么攻击者可以搭建一个邮服,也把自己的域名配置为example.com,然后发邮件给真实的企业员工xxx@e ...

  10. 【BZOJ3262】陌上花开 cdq分治

    [BZOJ3262]陌上花开 Description 有n朵花,每朵花有三个属性:花形(s).颜色(c).气味(m),又三个整数表示.现要对每朵花评级,一朵花的级别是它拥有的美丽能超过的花的数量.定义 ...