4
<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 ?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Sreeram
  • 67
  • 6
  • Try using google first.... And you are saying it works in wildfly 8 or 9? Or in 10 with a different jsf impl? – Kukeltje Mar 01 '16 at 10:02
  • 2
    Its working in 8. But not working in 9 and 10 – Sreeram Mar 01 '16 at 10:11
  • 1
    Read this http://stackoverflow.com/questions/11988415/what-is-the-jsf-resource-library-for-and-how-should-it-be-used ... and pay attention to the 'library' and 'name' parts – Kukeltje Mar 01 '16 at 10:15
  • 2
    The `library` attribute doesn't represent a folder/path. It represents a library name (e.g. `primefaces`, `omnifaces`, `javax.faces`, etc). If you have none, get rid of it and just use `name="test/css/style.css"`. – BalusC Mar 01 '16 at 11:10
  • 1
    It is not a WildFly 10 issue. – Tiny Mar 01 '16 at 14:48

1 Answers1

5

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

Kukeltje
  • 12,223
  • 4
  • 24
  • 47