zoukankan      html  css  js  c++  java
  • Tomcat的webapps目录下新建的目录不能访问

    为什么Tomcat的webapps目录下新建的目录不能访问html文件?
     

     在Tomcat安装目录中,webapps默认为部署网站用的目录。webapps/ROOT是网站的根目录,其它目录都是网站的子目录,如webappsjsp-examples目录。但是,当我们新建一个子目录时,却并不能在浏览器里正常访问。就连HTML文件也访问不了。为什么会出现这种情况呢?

      原来,在Tomcat中,每一个webapps下的子目录都被认为是一个JSP站点。因此,该子目录必需要有JSP站点的必要结构才行。也就是,在创建的子目录下,必需有WEB_INF目录以及WEB_INF下的web.xml文件。WEB_INF目录以及其下的web.xml文件,是JSP用来配置站点用的。

      以test子目录为例,以下就是正确配置Tomcat子目录的目录结构:

            webapps
                ┝ ROOT
                │        │
                │        ┕ …
                ┕ test
                            │
                            ┝ index.html
                            │
                            ┕ WEB_INFO
                                        │
                                        ┕  web.xml

      空的web.xml文件内容如下:

    <?xml version=”1.0″ encoding=”ISO-8859-1″?>
    <!
    Copyright 2004 The Apache Software Foundation

    Licensed under the Apache License, Version 2.0 (the “License”);
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an “AS IS” BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    >

    <web-app xmlns=”http://java.sun.com/xml/ns/j2ee”
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
    xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”
    version
    =”2.4″>

    <display-name>Welcome to Tomcat</display-name>
    <description>
    Welcome to Tomcat
    </description>

    </web-app>



  • 相关阅读:
    APP版本更新通知流程测试要点
    Android+appium +python 点击坐标tap方法的封装
    appium 元素定位find_element_by_android_uiautomator方法使用
    Android 应用加固(乐固)操作说明
    查询APP Store已发布过的版本记录
    appium 报错:AttributeError:"NoneType' object has no attribute 'XXX'
    appium 运行报错:...... Attempt to re-install io.appium.settings without first uninstalling解决方案
    Charles模拟网络请求页面的网络超时测试
    利用漏洞中验证码绕过的小技巧
    C中的volatile用法
  • 原文地址:https://www.cnblogs.com/beceo/p/2419699.html
Copyright © 2011-2022 走看看