How to install PrimeFaces theme?

I am trying to use the PrimeFaces application (v2.1) to use a different theme.

I downloaded vader-1.0.0.jar and put it in the WEB-INF / lib folder.

I added the following to my web.xml:

<context-param> <param-name>primefaces.THEME</param-name> <param-value>vader</param-value> </context-param> 

But when I launch the application, the theme does not change.

Is there anything else I am missing?

+7
source share
4 answers

Using PrimeFaces 2.1 I just put

 <link type="text/css" rel="stylesheet" href="#{request.contextPath}/themes/cupertino/skin.css"/> 

inside the <h:head> page (in my case, the template). Nothing else .. And it worked!

+6
source

Dynamic dynamic dynamics can be defined as follows:

web.xml:

 <context-param> <param-name>primefaces.THEME</param-name> <param-value>#{themeBeam.applicationTheme}</param-value> </context-param> 

Bean:

 @ApplicationScoped @ManagedBean public class ThemeBean { public String getApplicationTheme() { return "dark-hive"; } } 
+6
source

At least in PrimeFaces 2.2, the correct parameter in web.xml is primefaces.SKIN :

 <context-param> <param-name>primefaces.SKIN</param-name> <param-value>none</param-value> </context-param> 

Change from @ Cagatay comment : "primefaces.THEME is the official parameter name, others are outdated and will be removed in version 3.0."

This allows me to dynamically specify the skin using bean:

 @Named @SessionScoped public class LayoutBean { ... private String theme = "aristo"; ... public String getTheme() { return theme; } ... } 

Then in the markup:

 <link rel="stylesheet" href="#{request.contextPath}/themes/#{layoutBean.theme}/skin.css" /> 
+2
source

A jar-packed theme is supported since Primefaces 2.2 final .

"primefaces.THEME" replaces "primefaces.SKIN" in web.xml.

+2
source

All Articles