JSF/Facelets : CSS file is not being recognized using tag

前端 未结 2 1826
梦如初夏
梦如初夏 2021-01-03 21:44

I\'m working on a project using JSF/Facelets. I want to do some CSS changes on my View XHTML, but nothing happen when i deploy my web application in my Tomcat Server. I\'ve

相关标签:
2条回答
  • 2021-01-03 22:13

    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

    0 讨论(0)
  • 2021-01-03 22:37

    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?

    0 讨论(0)
提交回复
热议问题