set a PrimeFaces theme

UI Components for JSF
Post Reply
nidheesh
Posts: 60
Joined: 24 Oct 2011, 13:21

27 Oct 2011, 12:09

how to set a PrimeFaces theme? I have downloaded a aristo-1.0.0 jar and added the following code in web.xml file .

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


but not working!Any idea?
Thanks,
Nidheesh

jguerra
Posts: 51
Joined: 26 Aug 2009, 13:03
Contact:

27 Oct 2011, 12:15

I have a quite similar problem with PF 3.0 M4. I am using my own theme and it seems it's broken in M4 because it works fine on M2 and M3.

Code: Select all

 <!-- <context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>none</param-value>
  </context-param> -->

User avatar
bercolax
Posts: 133
Joined: 02 Aug 2009, 13:27
Location: Courtallam, India
Contact:

27 Oct 2011, 12:21

Please try theme version 1.0.1 (not 1.0.0) for 3.0 M release
PrimeFaces 3.4, Seam Faces 3.0.2.Final, Glassfish v3.1, Mojarra 2.1.10, NetBeans 7.2, Hibernate JPA 2.0, Seam Persistence 3.0.0.Final Theme default HOT-SNEAKS

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

27 Oct 2011, 12:34

@jguerra, I created an issue yesterday: http://code.google.com/p/primefaces/iss ... il?id=2696
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

User avatar
undermensch
Posts: 140
Joined: 08 Jul 2010, 14:37
Location: Florida, United States

27 Oct 2011, 15:57

I had the same problem, but got it to work with this:

Code: Select all

<context-param>
        <param-name>primefaces.THEME</param-name>
        <param-value>#{preferences.theme.name}</param-value>
</context-param>
if you look at the head renderer, you see that the theme loaded would then be primefaces-{whateverStringyourBeanReturns}/theme.css. So I no longer specify a theme in on my page: it's now set by head renderer using value supplied by my bean (<param-value>#{preferences.theme.name}</param-value>).

org.primefaces.renderkit.HeadRenderer (excerpt)

Code: Select all

String theme = "aristo";
        String themeParamValue = context.getExternalContext().getInitParameter(Constants.THEME_PARAM);

        if(themeParamValue != null) {
            ELContext elContext = context.getELContext();
            ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
            ValueExpression ve = expressionFactory.createValueExpression(elContext, themeParamValue, String.class);

            theme = (String) ve.getValue(elContext);
        }

        encodeTheme(context, "primefaces-" + theme, "theme.css");
I assume that if you completely leave out the primefaces.THEME param, theme will default to aristo.
PrimeFaces-11.0.6 / Wildfly 24

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Oct 2011, 21:23

"none" keyword support enabled again, this was a regression after setting default theme to aristo, thanks!

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Oct 2011, 21:25

By the way if you use your own theme, I suggest creating it following PF theme conventions so you can swap easily.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 56 guests