Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label af:richTextEditor. Show all posts
Showing posts with label af:richTextEditor. Show all posts

Wednesday 19 April 2017

Get af:richTextEditor value without HTML formatting and tags using jsoup library

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 it
Cool Component - Using af:richTextEditor as text editor, HTML editor with custom toolbox in Oracle ADF

Friday 23 May 2014

Reading html source of a webpage (url) using Oracle ADF (af:richTextEditor) & Java

This post is about a common question asked in java-

How to read page source of a website ? or how to get html source of an url?

so for that there is a simple piece of code to read html source of a webpage using it's url, and i have added  af:richTextEditor (ADF Faces component for ricj text formatting) to show html form of url source

  • I have a page with one input text to capture url entered by user, a button to fetch html source of that webpage and a af:richTextEditor to show source code in editing mode and in html mode 

  • See how to get webpage source from an url using java and save it to a html file (download a webpage ), Bind inputText and richInputText to managed bean and craete a actionListener on button to get source

  •     // Input text Binding to get URL
        private RichInputText webPageUrlBind;
        // RickInput text Binding to set Source
        private RichTextEditor richTextBind;
        public void setWebPageUrlBind(RichInputText webPageUrlBind) {
            this.webPageUrlBind = webPageUrlBind;
        public RichInputText getWebPageUrlBind() {
            return webPageUrlBind;
        public void setRichTextBind(RichTextEditor richTextBind) {
            this.richTextBind = richTextBind;
        public RichTextEditor getRichTextBind() {
            return richTextBind;
        /**Method to get html source of url (webpage) and set this to rickTextEditor
         * @param actionEvent
        public void getSourceCodeAction(ActionEvent actionEvent) {
            URL url = null;
            try {
                if (webPageUrlBind.getValue() != null) {
                    // Define your URL- Get value from input text using binding
                    url = new URL(webPageUrlBind.getValue().toString());
                URLConnection conn = url.openConnection();
                // open the stream and put it into BufferedReader
                BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                String inputLine;
                String sourceCode = "";
                //Save html file (HTML Source Code of given URL)
                String fileName = "D:/web-content.html";
                File file = new File(fileName);
                if (!file.exists()) {
                //use FileWriter to write file
                FileWriter fw = new FileWriter(file.getAbsoluteFile());
                BufferedWriter bw = new BufferedWriter(fw);
                System.out.println("Printing WebPage source on console, Please wait...\n");
                while ((inputLine = br.readLine()) != null) {
                    sourceCode = sourceCode.concat(inputLine);
                System.out.println("\n\nYour file is save in D drive! Congratulations ");
            } catch (MalformedURLException e) {
            } catch (IOException e) {

  • now click on button and see , here i am getting source code of this blog

  • now switch RichTextMode to see html preview of this source, it is exactly looking like live webpage, it shows one can practice in this ADF Faces's rickTextEditor to learn html tags

  • and see in D drive of your system a file named web-content created , it contains whole source of this webpage
 Cheers - Happy Learning :)

Wednesday 28 August 2013

Cool Component - Using af:richTextEditor as text editor, HTML editor with custom toolbox in Oracle ADF

Hello all,
this post is about af:richTextEditor component in ADF,
This component is used  for text formatting ,colors, it supports links,lables, messages etc and can be used as mail editor, blog editor
  • af:richTextEditor looks like this on page
  • User can use it for text formatting on page as-
  • It supports both Rich text and HTML,you can see by switching over editing modes (Rich text editing mode, Source code editing mode)

  • If you want to use this as simple text editor go to source editing mode and just write plain text

  • One very good thing is that you can use this HTML editor, go to Source Editing Mode and write HTML code, then switch to Rich Text Editing Mode to view result, so it can be used as basic html editor on web page
HTML code-
  •  Other than this user can control its toolbox structure and layout, there is a property named ToolboxLayout, some built in value for this property are
       all, font, history ,mode, color, formatAll, formatUncommon, justify, list, indent, link, newline
       look in snaps-