Primefaces themeSwitcher选择主题

时间:2014-09-28 19:03:59

标签: jsf primefaces themes

我用于在showcase中设置Primefaces themeSwitcher组件。列表即将发布但是themeSwitcher值为null。这是代码

 <h:panelGrid id="themeForm" columns="2">
    <h:outputLabel value="#{res['ko.settings.tabThemeSettings.themeName']}" />
    <p:outputPanel>
            <p:themeSwitcher id="basic" 
                             style="width:165px"
                             value="#{settingsBean.selectedTheme}">
                    <f:selectItems value="#{settingsBean.themes}" 
                                   var="theme"
                                   itemLabel="#{theme.displayName}" />
            </p:themeSwitcher>
            </p:outputPanel>
            <p:commandButton id="themeButton"
                 value="#{res['ko.settings.tabThemeSettings.themeButton']}"
                 icon="#{res['ko.saveIcon']}"
                 actionListener="#{settingsBean.saveTheme}" 
                 process="@this" update="basic"/>
 </h:panelGrid>

在带有getter和setter的支持bean中;

private Theme selectedTheme;

1 个答案:

答案 0 :(得分:0)

由于您使用value="#{settingsBean.themes}"作为列表主题值,并使用value="#{settingsBean.selectedTheme}"从主题列表中获取值,但您没有转换器来转换主题