Primefaces no themes

UI Components for JSF
Post Reply
Coelho
Posts: 15
Joined: 27 Sep 2011, 17:17

18 Nov 2011, 14:49

Hi all....

How to configure primefaces to not use default theme?
My app use jquery themeroller..

I would like my application to manage themes, is that possible?

spauny
Posts: 75
Joined: 10 Oct 2011, 16:42

18 Nov 2011, 15:01

Coelho wrote:Hi all....

How to configure primefaces to not use default theme?
My app use jquery themeroller..

I would like my application to manage themes, is that possible?
In GuestPreferences.java you have a private field called theme; you set it's value to what ever theme you want:

Code: Select all

private String theme = "dark-hive"; //default
Also if you want to be session scoped you use:

Code: Select all

<context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>#{themeSwitcherBean.theme}</param-value>
    </context-param>
where themeSwitcherBean is a session scoped bean...(Using EL can make your life better!)

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

18 Nov 2011, 15:43

You can use:

Code: Select all

<context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>none</param-value>
</context-param>
to disable the default theme and add your css in the h:head tag:

Code: Select all

<h:head>
       <f:facet name="first">
              <link href="#{request.contextPath}/css/jquery.theme.css" rel="stylesheet" type="text/css" />
      </f:facet>
</h:head>
The first facet is required because the theme should be rendered BEFORE PrimeFaces structural css.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Coelho
Posts: 15
Joined: 27 Sep 2011, 17:17

18 Nov 2011, 19:31

Hi Zoigl, its works...

Spaun,this idea I will use in the future..
tanks for answers.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 32 guests