Converter moeda do padrão americano para padrão brasileiro[RESOLVIDO]

1 resposta
LipeJava

Estou com um problema com o padrão de moeda americano!
Tenho duas variaveis do tipo double, onde será fornecido o valor de abertura e de fechamento de caixa.
Quando passo o valor 50,00 o sistema interpreta como 50,000 e se passar 50.00 fica correto!

Gostaria de saber como mudar isto, pois o padrão brasileiro é de #.##0,00 e o padrão americano é #,##0.00

Dialog

<h:form id="frmAbFeCaixa">
		<h:panelGrid columns="2">
			<h:outputText value="#{msg.usuario}"/>
			<h:inputText id="abFeFormLogin" value="#{managedCaixaAberto.login}">
				<p:ajax event="blur" action="#{managedCaixaAberto.consultaLogin}"
					update="pnCxDt, pnCxVlAb, pnCxVlDtFec, vlFech, nrCaixa"/>
			</h:inputText>
				
			<h:outputText value="#{msg.senhaCaixa}"/>
			<h:inputSecret id="abFeFormSenha" value="#{managedCaixaAberto.senha}"/>
		</h:panelGrid>
		<h:panelGrid columns="2" id="pnCx">
			<h:outputText value="#{msg.nrCaixa}"/>
			<h:inputText id="nrCaixa" value="#{managedCaixaAberto.caixaAberto.nrCaixa}" 
					disabled="true" />
			<h:outputText value="#{msg.dtAbertura}"/>
			<p:calendar id="pnCxDt" pattern="dd/MM/yyyy HH:mm" value="#{managedCaixaAberto.caixaAberto.dtAbertura}" 
					disabled="true"/>
			
			<h:outputText value="#{msg.vlrAbertura}"/>
			<h:inputText id="pnCxVlAb" value="#{managedCaixaAberto.caixaAberto.valorAbertura}" 
					disabled="#{managedCaixaAberto.caixaAberto.nrCaixa != null}" >
				<f:convertNumber pattern="#,##0.00"/>
				<p:ajax update="vlFech, pnCxVlAb" event="blur" />
			</h:inputText>
			
			<h:outputText value=""/>
			<h:outputText value=""/>
			
			<h:outputText value="#{msg.dtFechamento}"/>
			<p:calendar id="pnCxVlDtFec" pattern="dd/MM/yyyy HH:mm" value="#{managedCaixaAberto.caixaAberto.dtFechamento}" 
					disabled="true"/>			
			
			<h:outputText value="#{msg.vlrFechamento}"/>
			<h:inputText id="vlFech" value="#{managedCaixaAberto.caixaAberto.valorFechamento}"
					disabled="#{managedCaixaAberto.caixaAberto.nrCaixa == null or managedCaixaAberto.caixaAberto.valorFechamento != null}">
				<f:convertNumber pattern="#,##0.00"/>
				<p:ajax update="vlFech" event="blur" />
			</h:inputText>
		
			<p:commandButton value="#{msg.abrirFechar}" action="#{managedCaixaAberto.operarCaixa}" 
				pdate="abFeGrowl, pnCxDt, pnCxVlAb, pnCxVlDtFec, vlFech" />
			
			<p:commandButton value="#{msg.cancelar}" onclick="aberturaFechamentoCaixa.hide();" />
			
			<p:commandButton value="#{msg.reAbrir}" onclick="reaberturaCaixa.show();" update="frmReabCaixa" 
						action="#{managedCaixaAberto.novo}" />
			<p:commandButton value="#{msg.imprimir}" onclick="dlgEspelhoFechaCaixa.show();" />
		</h:panelGrid>

1 Resposta

A

vc pode usar assim

<f:convertNumber currencySymbol="R$" type="currency"/>

ou pode setar o locate do jeito que vc ta fazendo

t+

Criado 19 de setembro de 2011
Ultima resposta 19 de set. de 2011
Respostas 1
Participantes 2