Theme page default <p:themeSwitcher>

UI Components for JSF
Post Reply
felipe2211
Posts: 1
Joined: 05 May 2014, 04:04

05 May 2014, 04:17

Hi,

I need to select a default theme that appears when loading page
for example:

<p:themeSwitcher value="pepper-grinder" style="width:165px" id="defaultSwitcher" >
<f:selectItems value="#{bean.themes}"/>
</p:themeSwitche>

and default to that page "pepper-grinder" will be the theme

Thank you very much for your help..!

User avatar
panicj
Posts: 15
Joined: 05 May 2014, 13:04
Location: Croatia

20 May 2014, 14:11

you can create bean ( for example )

Code: Select all

@ManagedBean
@RequestScoped
public class ThemeSwitcherBean 
Put there

Code: Select all

private String theme;
When you call getter

Code: Select all

public String getTheme() {
            // maybe some other logic, logic from db etc.

		if (theme == null)
			theme = "cupertino";
and in your

Code: Select all

<p:themeSwitcher value="#{themeSwitcherBean.theme}" style="width:165px" id="defaultSwitcher" >
<f:selectItems value="#{bean.themes}"/> <- put this also in themeSwitcherBean ?
</p:themeSwitche>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Nerd PDF and 25 guests