primefaces with custom css file

Java Player picture Java Player · Apr 28, 2013 · Viewed 25k times · Source

Good morning, i have a problem in applying a style sheet on a primefaces commandButton , the button element is as follows:

        <p:commandButton value="Complains" styleClass="styleOrange"/>

and the style sheet:

    .styleOrange {    
    background-color: orange;
}

the css file is placed in the resources folder under css folder:

here's the include statement of the css file:

<h:head>

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

</h:head>

Answer

Daniel picture Daniel · Apr 28, 2013

There is no need for the /resources/ prefix. JSF already implicitly loads resources from there.

Just change the name into css/style.css, like this:

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

You should also read this What is the JSF resource library for and how should it be used?