Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

themeSwitcher não funciona ao mudar de página

Mesmo inserindo a configuração do context_param no meu web.xml, quando eu altero o tema para Aristo e mudo pra tela de autores, o tema volta para Vader. Favor me ajudar se faltou alguma configuração? Segue parte do meu template

            <h:form rendered="#{usuarioLogado != null}">
               <p:themeSwitcher id="basic" style="width:165px" vaue="#{temaBean.tema}">
                    <f:selectItem itemLabel="Choose Theme" itemValue="" />
                    <f:selectItem itemLabel="Aristo" itemValue="aristo" />
                    <f:selectItem itemLabel="Vader" itemValue="vader" />
                    <f:selectItem itemLabel="Omega" itemValue="omega" />
                    <f:ajax />
                </p:themeSwitcher>
            </h:form>

meu web.xml

<context-param>
        <param-name>
            javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE
        </param-name>
        <param-value>
            true
        </param-value>

        <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
        <param-value>true</param-value>

        <param-name>primefaces.FONT_AWESOME</param-name>
        <param-value>true</param-value>

        <param-name>primefaces.THEME</param-name>
        <param-value>#{temaBean.tema}</param-value>
    </context-param>

minha classe TemaBean

@ManagedBean
@SessionScoped
public class TemaBean implements Serializable {    

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private String tema = "vader";

    public String getTema() {
        return tema;
    }

    public void setTema(String tema) {
        this.tema = tema;
    }

}
1 resposta
solução!

Consegui descobrir onde estava o erro, eu havia escrito o atributo value errado no p:themeSwitcher e após o ajuste funcionou corretamente.

 <h:form rendered="#{usuarioLogado != null}">
               <p:themeSwitcher id="basic" style="width:165px" value="#{temaBean.tema}">
                    <f:selectItem itemLabel="Choose Theme" itemValue="" />
                    <f:selectItem itemLabel="Aristo" itemValue="aristo" />
                    <f:selectItem itemLabel="Vader" itemValue="vader" />
                    <f:selectItem itemLabel="Omega" itemValue="omega" />
                    <f:ajax />
                </p:themeSwitcher>
            </h:form>

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software