JSF faces config file outside WEB-INF?

前端 未结 3 720
执念已碎
执念已碎 2021-01-12 19:20

When creating multiple faces config files, it is correct to have the faces-config.xml outside of WEB-INF? The JSF spec does not seem to be very clear about this (Section 10.

3条回答
  •  感情败类
    2021-01-12 20:26

    If you are referencing them from the web.xml, then the file needs to be in the war at runtime. There are other ways that the container can discover faces-config.xml resources.

    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 “/WEBINF/ faces-config.xml”, and load it if the resource exists.

提交回复
热议问题