code: protected void encodeMask(FacesContext context,
                              InputText inputText,
                              String fieldId,
                              ResponseWriter rw) throws IOException {
      if (inputText.getMask() != null && !inputText.getMask().isEmpty()) {
        rw.startElement("script", inputText);
        rw.writeText("Inputmask(", null);
        if (inputText.getMask().trim().startsWith("{")) {
  	rw.writeText(inputText.getMask().trim(), null);
        }
        else {
  	rw.writeText(String.format("\"%s\"", inputText.getMask().replace("\"", "\\\"")), null);
        }
        rw.writeText(").mask(document.getElementById(\"", null);
        rw.writeText(fieldId, null);
        rw.writeText("\"));", null);
        rw.endElement("script");
      }
    }
docs: Add script to enable the input mask. If the mask attribute starts with {@code {}} the value is expected to be a
  JSON object (and can for example be used to set a regular expression: {@code {regex:'[0-9\u0600-\u06FF]*'}}).
  
  See https://github.com/RobinHerbots/Inputmask.
  
  @param context
  @param inputText
  @param fieldId
  @param rw
  
  @throws IOException