Reputation: 1032
I am trying to include my stylesheets within the <h:head>
tag utilising the following JSF tag: <h:outputStylesheet name="stylesheets/bootstrap.min.css" />
, however when I load my page I get RES_NOT_FOUND for this specific CSS resource when looking through dev tools in the web browser.
I am trying to call the stylesheet within one of my template files I have created, "default.xhtml". Please refer to the image attached below to see my project directory structure, and where the red arrow indicates where the tag is being utilised.
Within the default.xhtml template, I have defined the <h:head>
tags although it appears to still not be working. Is there anything I am missing which is not allowing this to be loaded?
If you require more information, please let me know. I would like to resolve this issue as quickly as possible.
Upvotes: 1
Views: 5028
Reputation: 1032
I figured out the issue here.
By default, I believe that JSF resource handling mechanism does not support for mapping the resource
directory which resides in the WEB-INF directory. In order to overwrite this default, you need to explicitly define a new <context-param>
within the project web.xml file.
The following fragment of code below specifies the directory used for resource lookup in the file system of the web application.
<context-param>
<param-name>javax.faces.WEBAPP_RESOURCES_DIRECTORY</param-name>
<param-value>/WEB-INF/resources</param-value>
</context-param>
Upvotes: 2