简体   繁体   English

用于Java服务器界面的web.xml

[英]web.xml for java server faces

I have just started learning about Java server faces and successfully tested out my first web app in JSF. 我刚刚开始学习Java服务器界面,并在JSF中成功测试了我的第一个Web应用程序。

What puzzles me is that the navigation rules are specified in my faces-config.xml located in my WEB-INF folder and no where in my web.xml have i specified the location of my faces-config.xml file location. 让我感到困惑的是,导航规则是在WEB-INF文件夹中的faces-config.xml中指定的,而在web.xml中没有指定我的faces-config.xml文件位置的位置。

So how does navigation take place ? 那么导航如何进行?

The JSF 1.2 specification (JSR 252) requires any JSF implementation to automatically load /WEB-INF/faces-config.xml at startup (if such a resource exists). JSF 1.2规范(JSR 252) 要求任何JSF实现在启动时自动加载/WEB-INF/faces-config.xml (如果存在这样的资源)。

Quoting the section 10.4.2 Application Startup Behavior: 引用部分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: 在应用程序启动时,在处理任何请求之前,JSF实现必须处理零个或多个根据以下算法定位的应用程序配置资源:

  • 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 ). 在此Web应用程序的ServletContext资源路径中搜索所有名为“META-INF/faces-config.xml”的资源,并将每个资源作为JSF配置资源加载(以与getResources()返回它们的顺序相反的顺序getResources()在当前线程的ContextClassLoader )。
  • Check for the existence of a context initialization parameter named javax.faces.CONFIG_FILES . 检查是否存在名为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. 检查是否存在名为“/WEB-INF/faces-config.xml”的Web应用程序配置资源,如果存在该资源,则将其加载。

我相信web.xml定义的Faces servlet在Web应用程序启动时会加载faces-config.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM