1 Reply Latest reply on Sep 21, 2011 8:17 AM by Martin Dames

    Extract text from SeamText , rich:editor

    Martin Dames Newbie

      Hi all,

      i would like to check the number of characters provided by user input through the rich:editor component. As far as I know this is not possible because the string returned by the editor ist html or seam text markup. Exist there a way to get the plain text input without markup to check against the maximum number of characters?

      In my case users should only be able to write 1000 characters in the rich:editor.

      Thank you.

        • 1. Re: Extract text from SeamText , rich:editor
          Martin Dames Newbie

          Here is my own solution:

          This can be accomplished with jsoup (http://jsoup.org/) in an custom validator:

          public void msgValidator(FacesContext context, UIComponent component, Object value) {
               // extract text from string with html tags
               String pureText = Jsoup.parse((String) value).body().text();
               if (pureText.length() > MAX_LENGTH_FOR_MSG) {
                    throw new ValidatorException(new FacesMessage());

          works nicely if you are using rich:editor with


          Hope I could help someone.