JSF/Facelets : CSS file is not being recognized using <h:outputStylesheet> tag

蹲街弑〆低调 提交于 2019-12-01 02:53:26
BalusC

The <h:outputStylesheet> (and <h:outputScript>) requires a <h:head>, but you've there a <head>. Fix it accordingly.

<h:head>
    <h:outputStylesheet name="css/styles.css" />
</h:head>

Further, you need to ensure that the css/styles.css file is been placed in the /resources subfolder of the public webcontent.

WebContent
 |-- resources
 |    `-- css
 |         `-- styles.css
 :

As to your attempt to use the library attribute, be careful with this, using library="css" isn't entirely correct in this context. See also: What is the JSF resource library for and how should it be used?

Aman birjpuriya

Add resources folder under the WebContent

and inside resources create css folder

then access the files like this

h:outputStylesheet library="css" name="myNewStylesFile.css" target="head" under h:head section that you did not add

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!