0
I’m having a problem using the ajax of primefaces, I also tried with the ajax of jsf. I have the following code snippet:
<h:panelGroup>
<p:inputText id="skuProduto" size="20" maxlength="20"
value="#{cadastroProdutoPapBean.produto.sku}"
validator="#{cadastroProdutoPapBean.validaProduto}">
<p:ajax event="keyup" execute="@this" update="mesSkuProduto, teste"/>
</p:inputText>
<p:message display="text" for="skuProduto" style="color:red"
id="mesSkuProduto" rendered="true" />
<h:outputText id="teste"value="Aqui o teste do que foi digitado: #{cadastroProdutoPapBean.produto.sku}" style="color:red"></h:outputText>
</h:panelGroup>
I tested using:
p:ajax event="keyup"
p:ajax event="blur"
And in both situations when bringing the typed value to the method it remains missing the last character Example of the return:
Valor do sku digitado: 33221
I put an outputText in the shown snippet to check what was being printed and returns the correct value.
Someone’s been through this, and there would be a solution to this problem?
I’m using it on my bean @Viewscoped and search the value typed with:
System.out.println("Valor do sku digitado: " + produto.getSku());
Enter Mbean’s code then, which you are bringing without the last digit.
– Giuliana Bezerra
My bean is quite large, so I put the relevant information of the bean.
– Edjane
Where is the system out that prints the value with one digit less? Puts the context in which it is inserted.
– Giuliana Bezerra
Hi Giuliana, I managed to solve the problem, I thought it was on the jsf page but actually it was in the method, silly that I was doing. I’ll make an answer with the solution.
– Edjane
That’s why I needed the Mbean post, you know? Only with what you exposed in your question could not know the problem. Put Mbean’s code in the question.
– Giuliana Bezerra
Hi Giuliana, thank you for your interest in helping, as you thought it was not a problem in the method and because it contains a lot of information I thought there was no need, my mistake. But in the answer I specified the problem and the solution!
– Edjane