0
Good morning guys, I have the following problem. My system makes changes to a table in the database, if the content is inserted directly by script in postgres, the accent works normally, but when updating the text by the system, the accent does not work. Follow xhtml and manageBean code:
XHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <h:body> <ui:composition template="/pages/protected/templates/master.xhtml"> <ui:define name="divMain"> <h:form> <h2 style="padding-left:10px;">Customização da Certidão de Dívida Ativa</h2> <table> <tr>
<td>
<h:outputText value="Título do Relatório: " style="margin-left:5px;"/>
</td>
<td>
<p:inputTextarea rows="1"
label="dsTitulo" style="width:1000px;"
counterTemplate="{0} caracteres restantes."
id="dsTitulo"
value="#{div_customizacao_certidao_divida_ativaMB.dsTitulo}"
required="true" />
</td> </tr> <tr>
<td>
<p:commandButton action="#{div_customizacao_certidao_divida_ativaMB.update()}"
value="Salvar" ajax="false">
</p:commandButton>
</td> </tr>
</table> </h:form> </ui:define> </ui:composition> </h:body> </html>
MB
public void update() {
try {
certidaoDividaAtivaCustomizacao.setDescricaoTitulo(getDsTitulo());
getCertidaoDividaAtivaCustomizacaoFacade().update(certidaoDividaAtivaCustomizacao);
displayInfoMessageToUser("Registro salvo com sucesso!");
certidaoDividaAtivaCustomizacao = null;
loadCertidaoDividaAtivaCustomizacao();
} catch (RollbackException ce) {
ce.printStackTrace();
try {
Exception ex = ce;
while (!(ex instanceof BatchUpdateException)) {
ex = (Exception) ex.getCause();
}
} catch (Exception e) {
displayErrorMessageToUser(ce.getMessage());
}
} catch (Exception e) {
displayErrorMessageToUser(e.getMessage());
e.printStackTrace();
}
}
Vlw for the answer Uriel, quite complete. I had Debbugando the code and the problem is the value that comes from the screen, because as soon as I click on save, goes to the UPDATE method, and the item already pulls the value of the converted screen. I just haven’t been able to solve the problem yet. Have I tried changing from <?xml version='1.0' encoding='utf-8' ? > to <?xml version='1.0' encoding='ISO-8859-1' ? > but it didn’t work either. The database is set right. I have other screens in the system that update or insert values in the bank and have no problem with accentuation, but for some reason this screen is not saved properly.
– jveing