java – How to do the<p:editor> do primefaces escape the special characters typed by the user before writing them?


I'm using primefaces component. My problem is that it is recording the accents that the user types in the text without doing the proper HTML escaping . Is there a way to change this so he knows that the letter is an accent and needs to perform the proper HTML escape ?

Below is the code:

<p:editor id="corpoEmail" widgetVar="editorWidget" value="#{corpoEmailControl.corpoEmail}" width="700"  maxlength="2000"  />


When saving the field to the database, use Apache Commons Lang's StringEscapeUtils :

import org.apache.commons.lang3.StringEscapeUtils;

// ...

String corpoEmailEscapado = StringEscapeUtils.escapeHtml4(corpoEmail);
Scroll to Top