af:richTextEditor
is used to format text in rich text using HTML formatting and it is used to get the formatted text. Previously I have posted about itCool Component - Using af:richTextEditor as text editor, HTML editor with custom toolbox in Oracle ADF
But I have seen developers asking about getting plain text value from richTextEditor,
It means on UI editor shows HTML formatted text but when getting value in managed bean it should ignore HTML tags and formatting
This component is designed for rich text editing so there is no direct way to get plain text
So for this requirement we need to parse HTML into plain text, Here I am using jsoup java library to parse HTML
When we get this value in bean using component binding it returns
Now to get plain text without formatting just parse this HTML using jsoup library, Add library to viewController project
and use this simple code
import org.jsoup.Jsoup; import org.jsoup.nodes.Document; Document doc = Jsoup.parse(ritValue); System.out.println(doc.text());
and it returns
Cheers :) Happy Learning
good work
ReplyDeleteThank you so much Ashish for this
ReplyDeleteI was looking for same , You saved my day
It may be used in the form of H1, H2, H3 etc. to define the subheadings in a page. This helps in breaking content into logical parts.
ReplyDeleteStartPoint