Search code examples
jsfdirectoryjsf-2.2outputstylesheet

Wildfly 10 issue with css file


<h:outputStylesheet library="test/css"  name="style.css" />

Above code is not working in wildfly 10 with jar file jsf-impl-2.2.12-jbossorg-2.

Issue getting is:

WARNING [javax.enterprise.resource.webcontainer.jsf.application] (default task-6) JSF1064: Unable to find or serve resource, style.css, from library, test/css.

Can anyone help on this ?


Solution

  • The value of a library attribute should not be a path but a reference to a single folder (grouping css ,js etc.) and a direct descendant of the resources folder.

    So changing

    <h:outputStylesheet library="test/css"  name="style.css" />
    

    to

    <h:outputStylesheet library="test"  name="css/style.css" />
    

    should make it work.

    Mojarra has been too liberal in this and it seems they are 'improving' things. I ran into a similar difference with the location of composite components. MyFaces did not allow paths in there as well, while Mojarra (until at least 2.2.12) still does.

    For more details on best usage, see