Search code examples
primefacescommandbutton

image is not showing up with primefaces commandbutton - icon attribute


Image is not showing up with primefaces commandbutton - icon attribute

I tried below styles but of no use

1.  .ui-icon-csv{
background-image: url("#{resource['/images/csv.jpg']}") !important;
}

2.  .ui-icon-csv{
background-image: url("#{resource['images/csv.jpg']}") !important;
}

css file path:

<link rel="stylesheet" type="text/css" href="css/style.css" />

Project structure: Not able to post image

projectname ->
             css
             images
             js
             index.jsp etc

There is no resource folder in project. So, It is giving problem with image path for icon

Kindly let me know how to resolve this???

Thanks...


Solution

  • In the built WAR-file your image should be at resources/images/csv.jpg. JSF specification defines that there must be the resources folder.

    Your project structure is up to you and/or your build tool. E.g., for Maven see this answer.