gpt4 book ai didi

java - 用于 Java 服务器面孔的 web.xml

转载 作者:行者123 更新时间:2023-11-29 08:18:48 25 4
gpt4 key购买 nike

我刚刚开始学习 Java 服务器界面,并成功地在 JSF 中测试了我的第一个 Web 应用程序。

令我困惑的是,导航规则是在我的 WEB-INF 文件夹中的 faces-config.xml 中指定的,而在我的 web.xml 中没有指定我的 faces-config.xml 文件位置的位置。

那么导航是如何发生的呢?

最佳答案

JSF 1.2 specification (JSR 252) 要求任何 JSF 实现在启动时自动加载 /WEB-INF/faces-config.xml(如果存在这样的资源)。

引用 10.4.2 应用程序启动行为部分:

At application startup time, before any requests are processed, the JSF implementation must process zero or more application configuration resources, located according to the following algorithm:

  • Search for all resources named “META-INF/faces-config.xml” in the ServletContext resource paths for this web application, and load each as a JSF configuration resource (in reverse order of the order in which they are returned by getResources() on the current Thread’s ContextClassLoader).
  • Check for the existence of a context initialization parameter named javax.faces.CONFIG_FILES. If it exists, treat it as a comma-delimited list of context relative resource paths (starting with a “/”), and load each of the specfied resources.
  • Check for the existence of a web application configuration resource named “/WEB-INF/faces-config.xml”, and load it if the resource exists.

关于java - 用于 Java 服务器面孔的 web.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2091041/

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