【问题标题】:adding directory to my servlet web-app web.xml将目录添加到我的 servlet web-app web.xml
【发布时间】:2017-02-04 18:09:27
【问题描述】:

基本上我有 servlet web-app,我的 web-app 项目中有一个目录,比如D:\resources,在我的 porject web.xml 中,我需要指定我的 web-app 需要的资源可能是在D:\resources 找到,如果您告诉我如何为我的项目 web.xml 文件指定目录,我将不胜感激。

提前致谢

【问题讨论】:

    标签: java xml servlets web.xml


    【解决方案1】:

    实现这一点的最佳方法是通过在应用程序服务器中定义 JNDI 来配置外部资源,然后在 web.xml 中引用相同的资源,例如

    <resource-description>
       <res-ref-name>myAppResources</res-ref-name>
       <jndi-name>myResource</jndi-name>
    </resource-description>
    

    【讨论】:

      猜你喜欢
      • 2017-02-04
      • 2012-12-12
      • 1970-01-01
      • 1970-01-01
      • 2014-12-02
      • 2015-12-29
      • 1970-01-01
      • 1970-01-01
      • 2014-03-07
      相关资源
      最近更新 更多