Stateless and stateful theme switchers
Multi-theme web applications require a theme switcher component. The default PrimeFaces' theme switcher is a component which enables switching themes on the fly, without sending an AJAX or a full-page request. We speak about a stateless theme switcher because the current selected theme is only known on the client side. Users also often need a stateful theme switcher to save the chosen theme on the server side in user preferences or settings.
In this recipe, we will show the usage of a stateless theme switcher and implement a stateful theme switcher, which is able to save the current selected theme on the server side.
How to do it…
The theme switcher usage is very similar to the usage of p:selectOneMenu
. The ...
Get PrimeFaces Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.