Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change PrimeFaces theme on the fly?

I have a multi-tenant system, the user is signed will have a custom theme in the application, I want to know if it is possible to change the theme "on the fly" after the user has signed. I'm new to Primefaces, thanks for your help!!

like image 209
Mariah Avatar asked Dec 07 '25 10:12

Mariah


1 Answers

Primefaces already implements jQuery UI's ThemeRoller. In your web.xml you can define a context-param primefaces.THEME with a parm-value pointing to session-scoped backing bean.

<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>#{FooBar.theme}</param-value>
</context-param>

See also: http://www.primefaces.org/primeui/themes.html

like image 111
WitYoBadSelf Avatar answered Dec 09 '25 23:12

WitYoBadSelf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!