January 2013
Intermediate to advanced
328 pages
7h 14m
English
By default, PrimeFaces theme switcher only changes the theme on the fly without sending an AJAX or full-page request. Users often want to get notified when the current theme has been changed in order to be able to update user preferences or settings.
In this recipe, we will implement two stateful theme switchers, which are able to save the current selected theme on the server side.
The next listing demonstrates a stateful theme switcher with attached AJAX behavior.
<p:themeSwitcher id="statefulSwitcher1" value="#{userSettingsController.theme}" style="width:165px" effect="fade"> <f:selectItem itemLabel="Choose Theme" itemValue=""/> <f:selectItems value="#{userSettingsController.themes}"/> <p:ajax ...Read now
Unlock full access