Problem with JSF TimeZone

0

This is my method in managerBean

public void carregarDadosVenda(){
    vendaCadastro.setHorario(new Date());
}

This is my page;

    <p:panelGrid columns="2">
        <h:outputText id="txtVendaValorTotal"
            value="Valor Total: #{carrinhoComprasBean.vendaCadastro.valor} " />
        <p:commandButton value="Finalizar Venda"
            action="#{carrinhoComprasBean.carregarDadosVenda}"
            oncomplete="PF('wvDlgFinVenda').show();" />
    </p:panelGrid>
</h:form>

<p:dialog closable="true" draggable="true" modal="true"
    resizable="false" header="Dados da Venda" widgetVar="wvDlgFinVenda"
    appendTo="@(body)">
    <h:form>
        <p:panelGrid columns="2">
            <h:outputText value="Horário " />
            <h:outputText value="#{carrinhoComprasBean.vendaCadastro.horario}">
                <f:convertDateTime pattern="dd/MM/yyyy"/>                   
            </h:outputText>
            <h:outputText value="Nome da Noticia " />
            <h:outputText  />
            <h:outputText value="Valor Toral " />
            <h:outputText />
        </p:panelGrid>
        <p:panelGrid columns="2">
            <p:commandButton value="Salvar: " />
            <p:commandButton value="Voltar: "
                onclick="PF('wvDlgFinVenda').hide();" />
        </p:panelGrid>

    </h:form>

And I put this in the web.xml file

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

Why does not the date still appear in my message box?

I've printed the value like this;

public void carregarDadosVenda(){

        vendaCadastro.setHorario(new Date());
    System.out.println("Horário >>>>>>>>>>>>>>>>"  + vendaCadastro.getHorario());   
    }

And I had this result here;

Schedule > > > > > > > > > >> Mon Aug 31 14:59:05 BRT 2015

===================================================== ========================

Something even stranger has happened;

I decided to redo the code all over again, and it worked again, but the time was wrong, and I wanted to synchronize the time with the TomCat server, and put that line of code in web.xml

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

After I did this, I no longer see the time in the dialog box, I even deleted it in the code line of the web.xml file, but there was no way, the time does not appear in the dialog box anymore.

Why does this happen?

    
asked by anonymous 31.08.2015 / 19:22

1 answer

0

Try this:

<h:outputText value="#{var.data}">
        <f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
</h:outputText>
    
25.09.2015 / 18:27