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. mysql中什么是物理备份?

    需求描述: 今天在看数据库备份,恢复的内容,就是对于一个概念,物理备份的理解,在这里记录下. 概念解释: 物理备份:就是对存储数据库内容的目录和文件的直接拷贝.简单来说,就是对物理文件的拷贝. 文档创 ...

  2. Tomcat 8(九)解读Tomcat组件的生命周期(Lifecycle)

    Tomcat 8(七)解读Bootstrap介绍过.运行startup.bat.将引发Tomcat一连串组件的启动.事实上这一连串启动是通过组件的生命周期(Lifecycle)实现的 今天来看看Lif ...

  3. Razor------引入css文件的方法

    MVC3.0之前版本: <link href=@Url.Content("~/Content/Styles.css") rel="stylesheet" ...

  4. Java类的设计----方法的重写、覆盖

    方法的重写.覆盖 在子类中可以根据需要对从父类中继承来的方法进行改造—覆盖方法(方法的重置.重写),在程序执行时,子类的方法将覆盖父类的方法. 覆盖方法必须和被覆盖方法具有相同的方法名称.参数列表和返 ...

  5. swift--动画效果

    一.for循环创建4*4个view,然后对立面的所有view进行动画,这里列集中动画的效果: 1,旋转动画 for tile in backgrounds{ //现将数字块大小职位原始尺寸的1/10 ...

  6. Python 字符串处理(转)

    转自:黄聪:Python 字符串操作(替换.删除.截取.复制.连接.比较.查找.包含.大小写转换.分割等) http://www.cnblogs.com/huangcong/archive/2011/ ...

  7. ubuntu的安装方法

    Ubuntu 是一个启动速度超快.界面友好.安全性好的开源操作系统,它由全球顶尖开源软件专家开发,适用于桌面电脑.笔记本电脑.服务器以及上网本等,并且它可以永久免费使用.如果你厌倦了Windows,如 ...

  8. C++中的抽象基类示例

    抽象基类(abstract base class,ABC)例子:圆与椭圆.建立一个基类BaseEllipse,建立它的恋歌继承了Ellipse和Circle.ellipse.h #ifndef ELL ...

  9. JS时间格式化函数

    Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, //month & ...

  10. K-mean和k-mean++

    (1)k-mean聚类 k-mean聚类比较容易理解就是一个计算距离,找中心点,计算距离,找中心点反复迭代的过程, 给定样本集D={x1,x2,...,xm},k均值算法针对聚类所得簇划分C={C1, ...