primefaces with custom css file

25,717

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?

Share:
25,717
Eslam Hamdy
Author by

Eslam Hamdy

Senior engineer with +9 years experience in java ecosystem, have one plus year experience in crafting and managing agile teams, has a passion for nature, mountain biking, swimming, traveling, tensegrity and coding.

Updated on October 12, 2020

Comments

  • Eslam Hamdy
    Eslam Hamdy over 3 years

    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>