This content has been marked as final.
Show 1 reply
-
1. Re: Extract text from SeamText , rich:editor
specialagent.specialagentx.web.de Sep 21, 2011 8:17 AM (in response to specialagent.specialagentx.web.de)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
viewMode="visual"
Hope I could help someone.