Skip to main content

JSF Primefaces Themes Example

·3 mins

Today you’re going to learn how to setup a PrimeFaces Theme.

More specifically we’ll configure the free Bootstrap community theme.


Let’s jump right in…

If you want to learn more about PrimeFaces for JSF - head on over to the JSF PrimeFaces tutorials page.

What are PrimeFaces Themes? #

PrimeFaces is integrated with the ThemeRoller CSS Framework in order to support different themes. There are three types of themes you can configure:

  1. You can purchase premium themes.
  2. You can choose from the free community themes (click the Community tab).
  3. You can create your own theme using the online theme generator tool of ThemeRoller.

The following example shows how to set up the Bootstrap PrimeFaces theme using Spring Boot and Maven.

General Project Overview #

We will use the following tools/frameworks:

  • PrimeFaces 6.2
  • JoinFaces 3.3
  • Spring Boot 2.1
  • Maven 3.5

Our project has the following directory structure:

jsf primefaces themes maven project

Maven Setup #

We start from a previous JSF Spring Boot Example in which we created a greeting dialog based on a first and last name input field.

As the PrimeFaces community themes are not available in the Maven central repository we need to specify the PrimeFaces Maven Repository in our Maven POM file as shown below.

Once this is done we need to include the dependency to the specific PrimeFaces theme we want to use.

Alternatively, we can include all available themes by specifying the all-themes dependency. We will do the later in this example.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""


  <description>JSF Primefaces Themes Example</description>

    <relativePath /> <!-- lookup parent from repository -->




      <name>PrimeFaces Maven Repository</name>


PrimeFaces Bootstrap Theme Setup #

As we are using JoinFaces to setup Spring Boot we can use an application property in order to configure a PrimeFaces theme.

We set the Bootstrap theme by specifying the jsf:primefaces:theme property in src/main/resources/application.yml as shown below.

    theme: bootstrap

Let’s check the new look of our web application. Execute following Maven command:

mvn spring-boot:run

Once Spring Boot has started, open a web browser and enter the following URL: http://localhost:8080/helloworld.xhtml.

The web page should now be displayed in the newly configured theme.

jsf primefaces bootstrap theme

If you would like to run the above code sample you can get the full source code on GitHub.

In this post, we illustrated how to configure the PrimeFaces Bootstrap theme using Spring Boot and Maven.

Drop a line below if you enjoyed reading this post.