How to make the p: editor of primefaces escape the special characters typed by the user before writing them?

5

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

Below is the code:

<p:editor id="corpoEmail" widgetVar="editorWidget" value="#{corpoEmailControl.corpoEmail}" width="700"  maxlength="2000"  />
    
asked by anonymous 16.04.2015 / 15:59

1 answer

0

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

import org.apache.commons.lang3.StringEscapeUtils;

// ...

String corpoEmailEscapado = StringEscapeUtils.escapeHtml4(corpoEmail);
    
10.03.2017 / 05:51