jsf-2primefacesprimefaces-mobile

Primefaces mobile theming


How can I set the theme of Primefaces mobile. I have set up the Primefaces repo in pom and set up the org.primefaces.themes dependency :

<repositories>
    <repository>
        <id>prime-repo</id>
        <name>Prime Repo</name>
        <url>http://repository.primefaces.org</url>
    </repository>
</repositories>

<dependencies>
    <dependency>  
        <groupId>org.primefaces.themes</groupId>
        <artifactId>all-themes</artifactId>
        <version>1.0.10</version>  
    </dependency>
</dependencies>

I also set primeface.THEME context-param in web.xml :

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

Here theme is a string which I set to "cupertino" in an @PostConstruct method. This however does not work. Since this is all from Primefaces example/docs and not Primefaces Mobile is there possible something extra I need to do?

Using Primefaces 5.0 and the built in mobile libs.


Solution

  • Just got it. Found it in the user guide : http://www.primefaces.org/docs/guide/primefaces_user_guide_5_0.pdf page 553

    In web.xml just change the context-param to primeface.mobile.THEME :

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