PrimeFaces provides a component called ThemeSwitcher, which allows us to change themes dynamically without having to refresh the page that we are on. In order to get this to work, we need to create some classes known as JavaBeans, which provide things that the ThemeSwitcher needs in order to work its magic.
We are going to add some new packages to our project and then create our Beans. Perform the following steps to add new packages to our project:
Right-click on the project in the Project view and select New….
You may have to scroll down a bit or even select the Other… option, but we are looking for the Java option. This displays a list of things that we can create, and we want a package.
We add a package with the name
com.andyba.pfthemes.session
keeping the other values as they are.Then, add another package named com.andyba.pfthemes.themes.
Now, in order to create our first Bean, perform the following steps:
Select New… by right-clicking on the themes package...