O'Reilly logo

Mastering JavaServer Faces 2.2 by Anghel Leonard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing a theme switcher

If you are a PrimeFaces fan, then I'm sure you have seen the PrimeFaces theme switcher. Basically, a theme switcher is represented by a drop-down menu that contains themes' names and thumbnails. End users can switch between application's themes just by selecting it from the list.

In this section, you will see how to develop a theme switcher using the JSF 2.2 contracts. The goal is to obtain a theme switcher so that:

  • It can be added as a JAR in any JSF 2.2 application
  • It can automatically detect and list the themes of an application
  • It can give a nice look and feel, as shown in the following screenshot (shown on the left-hand side is the PrimeFaces theme switcher, and on the right-hand side is our theme switcher)

Obviously, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required