Faces-config.xml is a configuration file

By default, when you create a web application, faces-config.xmlit is not created automatically. We must create it manually, and, as I understand it, faces-config.xmlmust be strictly in WEB-INF.

So my question is:

Whether it is necessary to register faces-config.xmlin web.xmlafter creation in WEB-INFor in another folder or automatically register. That is, JSF "knows" what it is faces-config.xmland can find it in the entire project folder.

I hope I asked the right question .;)

+4
source share
1 answer

As taken from the FacesServletdocumentation:

, web.xml web-fragment.xml, .

  • faces-config.xml WEB-INF.

  • faces-config.xml META-INF jar .

  • , .faces-config.xml, META-INF jar .

  • javax.faces.CONFIG_FILES web.xml web-fragment.xml.

  • , onStartup() ServletContainerInitializer, .

-, :

  • , , , WEB-INF/META-INF;
  • web.xml:

    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>
            WEB-INF/path/to/faces-config.xml
       </param-value>
    </context-param>
    

faces-config.xml , .

+14

All Articles