gpt4 book ai didi

java - 我怎样才能为我的 webapps 中的一个文件夹打开列表,而不是为每个文件夹打开列表

转载 作者:行者123 更新时间:2023-11-30 11:52:06 24 4
gpt4 key购买 nike

目前我启用了列表(见下面的代码),这意味着每个文件夹都会受到影响。我怎样才能做到只有 webapps/myProject/myFolder 是可列出的?

<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>

我看过this document但我不明白。有人可以帮忙吗。

编辑:我的本地 web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"[]>
<web-app id="WebApp_ID">
<display-name>Project1</display-name>
<description>Project1</description>
<context-param>
<param-name>EnableSessionPersistency</param-name>
<param-value>False</param-value>
</context-param>
<context-param>
<param-name>DataDirectory</param-name>
<param-value>App_Data</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.aspx</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
<listener>
<listener-class>Mainsoft.Web.SessionState.SessionListener</listener-class>
</listener>
<servlet>
<servlet-name>VmwIncludeHelperServlet</servlet-name>
<servlet-class>Mainsoft.Web.Hosting.IncludeHelperServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>VmwDynamicServlet</servlet-name>
<servlet-class>GhDynamicHttpServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>XmlDynamicServlet</servlet-name>
<servlet-class>XmlContentTypeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XmlDynamicServlet</servlet-name>
<url-pattern>/rdTemplate/rdAjax/rdAjax.aspx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>/aspnetconfig</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>/aspnetconfig/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>/assemblies/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.mdf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.lck</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.properties</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.dat</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.ctrl</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.aspx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.asmx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.ashx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.invoke</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.soap</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.rem</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.axd</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.master</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.resource</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.skin</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.browser</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.sitemap</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.webinfo</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.resx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.asax</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.ascx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.config</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.Config</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.cs</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.vb</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.csproj</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.vbproj</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.licx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwDynamicServlet</servlet-name>
<url-pattern>*.dll</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>VmwIncludeHelperServlet</servlet-name>
<url-pattern>/servletincludehelper</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>20</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>Default.aspx</welcome-file>
</welcome-file-list>
</web-app>

最佳答案

而不是修改 web.xml$CATALINA_BASE/conf/web.xml 下, 将下面的配置放在你的本地 web.xml .

<servlet>
<servlet-name>default</servlet-name>
<servlet-class>
org.apache.catalina.servlets.DefaultServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

...

<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/path/to/listabledir</url-pattern>
</servlet-mapping>

这里的关键是行 <url-pattern>/path/to/listabledir</url-pattern> .

Tomcat Wiki应该给你一些引用。

关于java - 我怎样才能为我的 webapps 中的一个文件夹打开列表,而不是为每个文件夹打开列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7076858/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com