Appending HTML in JEditor/JTextPane (25 dukes)

HI:
Is there any way i can append HTML in JEditor/JTextPane,
as i gets the html data in chunks, so i want to append the html in the existing display in editorpane instead of refreshing it all time, which causes it to flicker,
Thanks in advance.

JEditorPane edit = new JEditorPane();
edit.setEditorKit(new HTMLEditorKit());
edit.setEditable(true);
edit.setText("<HTML><b>test<b></HTML>");
HTMLDocument doc=(HTMLDocument)edit.getDocument();
try {
doc.insertString(6,"new text",null);
catch (Exception ex) {}
see also other methods of HTMLDocument
best regards
Stas

Similar Messages

  • How to append html formatted text to JPaneText?

    Hi,
    I'm trying to append html to JPaneText and I can't do it. My code is below:
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.text.html.HTMLEditorKit;
    import javax.swing.text.html.*;
    import javax.swing.text.*;
    public
    class GUI
    extends JFrame {
         JTextPane wynikTxtAre = new JTextPane();
         JScrollPane suwak = new JScrollPane(wynikTxtAre);
         JPanel panelSrodek = new JPanel();
         HTMLDocument doc;
         HTMLEditorKit kit = new HTMLEditorKit();
         public GUI()
    super.setSize(640, 480);
    super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    wynikTxtAre.setEditable(false);
    wynikTxtAre.setDocument(kit.createDefaultDocument());
    doc = (HTMLDocument)wynikTxtAre.getDocument();
    suwak.setPreferredSize(new Dimension(600, 400));
    panelSrodek.add(suwak);
    super.getContentPane().setLayout(new BorderLayout());
    super.getContentPane().add("Center", panelSrodek);
    super.setVisible(true);     
         public static void main (String [] args) {
              GUI g = new GUI();
              try {
         Style style = g.doc.addStyle("StyleName", null);
         StyleConstants.setItalic(style, true);
         StyleConstants.setFontSize(style, 30);
         StyleConstants.setBackground(style, Color.blue);
         StyleConstants.setForeground(style, Color.white);
         // Append to document
         g.kit.insertHTML(g.doc, g.doc.getLength(), "tekxt", 1, 1, HTML.Tag.B);
         //g.doc.insertString(g.doc.getLength(), "<b>Some Text</b>", style);
         } catch (Exception e) {
              System.out.println(e.getMessage());
    If i use insertHTML method then there is no text on the text area.
    If i use insertString method then text appear but it doesn't resolve html tags.
    Please help.

    I did something like this:
    public
    class GUI
    extends JFrame {
    //previous code - no changes
         public static void main (String [] args) {
              GUI g = new GUI();
              StringBuffer buf = new StringBuffer();
              try {
         buf.append("<b>bb</b>");
         buf.append("<b>ccc</b>");
         // First append to document
         g.pane.setText(buf.toString());
    //Second append
         buf.append("<b>ddddd</b>");
         g.pane.setText(buf.toString());
         } catch (Exception e) {
              System.out.println(e.getMessage());
    I know that this method is not smart and doesn't look good, but it works.
    If you know how to append html using HTMLEditorKit and HTMLDocument please write some example.

  • HTML in a JTextPane

    I am displaying simple html in a JTextPane. I've built simple pages with <Input> tags, I load them in the JTextPane and it works - looks great. I can input into these fields, but my question is how can I programmatically get the entry values I've made?

    Hi Puce thanks for the comment.
    Actually I am never submitting this web pages - I created a component to display web pages and gather the resulting input into a Properties file. The purpose of this is to be able to create sophisticated setup/configuration screens (images, layout, etc) in J2SE using html, so like I said I'm never submitting the pages.
    Anyway, I worked out how to do what I needed - I subclassed the HTMLEditorKit and kind of hacked what it's doing. It's pointless, but pretty sweet.

  • Trouble using read() to append html text to JEditoPane()

    Trouble using read() to append html text to JEditoPane()
    I`ve created the method bellow in my GEditorPane class, wich extends JEditorPane. The problem is that, after each appended text, an undesired line break is added. I checked the getText() of the pane, and there was no <br> (but a \n) where the line breaks are localized, what is strange, since html doesn`t break lines with \n.
    Someone can help me ? Thankyou. SrLontra
    public void append(String str) {
    try {
    Document doc = getDocument();
    if (str == null || str.equals("")) {
    return;
    Reader r = new StringReader(str);
    HTMLEditorKit kit = (HTMLEditorKit) getEditorKit();
    kit.read(r, doc, doc.getLength());
    } catch (IOException ioe) {
    UIManager.getLookAndFeel().provideErrorFeedback(this);
    System.out.println("IOException :: appendHTML() :: GEditorPane");
    System.out.println(ioe.getMessage());
    } catch (BadLocationException ble) {
    UIManager.getLookAndFeel().provideErrorFeedback(this);
    System.out.println(     "BadLocationException :: appendHTML () :: GEditorPane");
    System.out.println(ble.getMessage());
    }

    Hello lukik,
    This is not exactly my problem, in my case, the break is not desired. For some reason, just before the appended text, a line break (\n) is inserted in the Document. And I don`t want this to happen. Added to this, why the HTML text breaks with the \n?
    Anyway, the threads were very instructive ^^.
    Thankyou. SrLontra.

  • How to embed image in html when using JTextPane, HTMLEditorKit, JavaMail

    I am developing a specialized e-mail client that has to be able to send e-mail messages (in html format with images and attachments) that can be read by standard e-mail clients, and receive similar messages from standard e-mail clients.
    I have everything working except for embedding images.
    Images are to appear in the document mixed in with the text, but that's not what I mean by "embed". By "embed" I mean that the image itself is encoded within the html.
    Here's a bit of code to set the context.
    JTextPane bodyPane = new JTextPane();
    bodyPane.setEditorKit(htmlEditorKit);
    bodyPane.setTransferHandler(new DropHandler());
    bodyPane.setDocument(new HTMLDocument());
    In the DropHandler I have the following:
    HTMLDocument htmlDoc = (HTMLDocument) bodyPane.getDocument();
    HTMLEditorKit htmlKit = (HTMLEditorKit) bodyPane.getEditorKit();
    int caretPos = bodyPane.getCaretPosition();
    At this point get "filename", the full path to an image file that has been dropped onto bodyPane.
    String htmlString = "<img src=\"file:///" + filename.replace("\\","/") + "\">";
    htmlKit.insertHTML(htmlDoc, caretPos, htmlString, 0, 0, HTML.Tag.IMG);
    This works just fine. The image is displayed in the document at the point of insertion.
    However, the image itself is an external file. I need to send an e-mail with this image and could send the image file as an attachment, but I obviously can't assume that the recipient of the email is going to save the attachment into the proper location.
    What is the best way to do this?
    There is a technique for embedding the actual image in the html, using this syntax:
    String htmlString = "<a href=\"data:image/png;base64,---mimed png image here--\" alt=\"Red dot\"></a>";
    I can't get this to work in JTextPane, so perhaps it's not supported. Also, there may be limitations on the size of an image. And apparently Internet Explorer doesn't support this.
    From what I read, using a "content identifier", that is, "cid:" and adding the image as another part of the e-mail message is probably the thing to do. I haven't taken the time to explore this yet.
    Does JTextPane support cid? Is that a nonsense question? I suspect what I need to do when the message is being composed is use absolute paths to local files with the images, and then when assembling the e-mail, attach the files and rewrite the html to build in the cid linkage. Similarly, when reading a message with cid's, the thing to do is save the body parts as files and rewrite the cid to point to the actual file.
    I have seen others ask similar questions, one as recently as last December, and the reply was to refer to a Sun tutorial. But that tutorial doesn't address the full problem of 1) inserting an image into a document (instead of attaching an image to a component) and 2) sending it as an e-mail message.
    I have yet to see an example that shows the complete package.
    Am I right that the data option I mentioned is not going to work?
    Am I right that cid is the best approach, and do I understand how to use it?
    Is there something else?
    Thanks
    John

    Hi Rocky,
    Are you using the DC?
    if yes then you need to put the image inside the component folder. after that close the application
    & reopen. You will get the image.
    In case this does not work then try refreshing the portal through server side. Once the cache is cleared, it will be up to view.
    Also check the Activity list you have created. It should be added to the dtr properly or else it wont be reflected once reimported the configurations.
    Regards
    Chander Kararia

  • Custom HTML tags in JTextPane

    Hi all,
    I have seen this topic broached before but, in spite of many hours searching, haven't found the answer I'm looking for...
    I jave a JTextPane containing an HTMLDocument and want to render elements within my own custom tag 'Custom' outlined in red.
    I have subclassed HTMLEditorKit as follows:import javax.swing.text.ViewFactory;
    import javax.swing.text.html.HTMLEditorKit;
    public class HTMLEditorKitForCustom extends HTMLEditorKit{
         public ViewFactory getViewFactory(){
              return htmlFactoryForCustom;
        private static final ViewFactory htmlFactoryForCustom = new HTMLFactoryForCustom();
    }I have subclassed HTMLEditorKit.HTMLFactory as follows:import javax.swing.text.View;
    import javax.swing.text.Element;
    import javax.swing.text.html.HTMLEditorKit;
    import javax.swing.text.StyleConstants;
    public class HTMLFactoryForCustom extends HTMLEditorKit.HTMLFactory{
         public View create(Element element){
              Object object = element.getAttributes().getAttribute(StyleConstants.NameAttribute);
              if(CustomView.CUSTOM_KEY_TAG.equals(object)){
                   return new CustomView(element);
              return super.create(element);
    }And, I have subclassed LabelView as follows:public class CustomView extends LabelView{
         public CustomView(Element element){
              super(element);
         public void paint(Graphics g, Shape a){
              super.paint(g, a);
              Rectangle rectangle = a instanceof Rectangle ? (Rectangle)a : a.getBounds();
              Graphics2D g2d = (Graphics2D)g;
              g.setColor(Color.RED);
              g.drawRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
         public static final String CUSTOM_KEY_TAG = "Custom";
         public static final String CUSTOM_TYPE_TAG = "ccVarType";
         public static final String CUSTOM_NUMERIC_TYPE_TAG_VALUE = "Numeric";
    }The JTextPane in question has its EditorKit set to my HTMLEditorKitForCustom throughtextPane.setEditorKit(new HTMLEditorKitForCustom();In combination, these classes ensure that when a <Custom>...</Custom> set of tags is encountered, the text between is rendered with a red outline.
    This works fine when the custom tags and text are inserted but, as soon as a change is made that affects the paragraph containing the custom tags (for example, change alignment, font size, etc.), the content disappears. However, the underlying HTML still shows the <Custom> tag, but with no closing tag and without the text the tags once contained.
    E.g. <Custom>Fred</Custom> becomes simply <Custom>.
    Any help in solving this problem will be greatly appreciated!
    Chris.

    Stas, thanks for your response!
    I did try registering the tag, and associating it with a SpecialAction then with a CharacterAction (I want the user to be able to change the font style, etc. of these Custom items).
    I did this by creating HTMLDocumentForCustom (original name, huh!), subclassing HTMLDocument and inner HTMLReaderForCustom:// (Within HTMLDocumentForCustom)
    public class HTMLReaderForCustom extends HTMLReader{
      public HTMLReaderForCustom(int pos){
        super(pos, 0, 0, null);
        registerTag(new HTML.UnknownTag(CustomView.CUSTOM_KEY_TAG), new SpecialAction());
    }Then I created a new HTMLDocumentForCustom and did textPane.setDocument(document). Now, when I inserted the text between Custom tags, I got this exception:javax.swing.text.BadLocationException: Invalid insert;
         at javax.swing.text.GapContent.insertString(GapContent.java:109);
         at javax.swing.text.AbstractDocument.handleInsertString(AbstractDocument.java:722);I was using the following code to insert the text:SimpleAttributeSet attributes = new SimpleAttributeSet();
    attributes.addAttribute(StyleConstants.NameAttribute, CustomView.CUSTOM_KEY_TAG);
    try{
      document.insertString(1, "Custom Here!", attributes);
    catch(BadLocationException ble){
      ble.printStackTrace();
    }Inserting at position 1 was working fine before trying to subclass HTMLDocument and HTMLReader, and there's already text in the document before trying the insert -- in fact it didn't matter what the insert location was set to, the exception kept occurring.
    Can you see anything obvious I've missed or am I barking totally up the wrong tree?
    Chris.

  • How to append text of one JTextPane to another JTextPaneacross the network.

    i am developing a chat software using client server architecture. i have a JTextPane on client end where the client types the message in multi colour,multi font and multi size formats. i can send the data to other clients but then i cannot send this formats in which the client wants to send the data. how should i achieve it. when i make the content type of the JTextPane then whatever client types it shows up properly but if i change the content type to text/html then what ever i try to type it just shows an <html> tag and doesn't show the text that the client types. i tried using the second content type with the idea of sending data to the server in html format so that when other clients JTextPane get it then it should display it that way. but it doesn't happen that way. ne suggestions?

    i am developing a chat software using client server architecture. i have a JTextPane on client end where the client types the message in multi colour,multi font and multi size formats. i can send the data to other clients but then i cannot send this formats in which the client wants to send the data. how should i achieve it. when i make the content type of the JTextPane then whatever client types it shows up properly but if i change the content type to text/html then what ever i try to type it just shows an <html> tag and doesn't show the text that the client types. i tried using the second content type with the idea of sending data to the server in html format so that when other clients JTextPane get it then it should display it that way. but it doesn't happen that way. ne suggestions?

  • Load HTML in a JTextPane

    Hallo,
    i try to load a simple html file into a JTextPane and then print out this file. I ve noticed, that my last (empty) td-tag-pair disapear. Why this happens? How can i avoid this?
    thanks
    bye
    my html file:
    <html>
      <head>
      </head>
      <body>
        <table border="1" height="200" style="border-style: solid" width="400">
          <tr>
            <td style="border-style: solid">
              1
            </td>
            <td style="border-style: solid">
              2
            </td>
           <td style="border-style: solid">
            </td>
          </tr>
        </table>
      </body>
    </html>and my java programm:
    import java.io.File;
    import javax.swing.JFrame;
    import javax.swing.JTextPane;
    import javax.swing.text.html.HTMLDocument;
    public class HTMLTest {
         public static void main(String[] args) {
              try {
                   JFrame frame = new JFrame();
                   frame.setSize(400,300);
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   JTextPane pane = new JTextPane();
                   HTMLDocument doc = (HTMLDocument) pane.getEditorKitForContentType("text/html").createDefaultDocument();
                   doc.setAsynchronousLoadPriority(-1);
                   pane.setDocument(doc);
                   File f = new File("1.html");
                   pane.setPage(f.toURL());
                   frame.add(pane);
                   frame.setVisible(true);
                   System.out.println(pane.getText());//Here it happens! Where is my last (empty) td-tag-pair?
              } catch (Exception e) {
                   e.printStackTrace();
    }

    Hey,
    It works fine for me.....Ur empty tag is showing up!......and one more suggestion is don't add data directly to JFrame..u have to call...getContentPane()..and add it...may be u have posted that thing wrongly ..anyway i have modified and it's working fine for me!

  • Nested html-tags in JTextPane not possible?

    Hi.
    Why does JTextPane not support contents like this:
    <p align="center">
      <h2>Hello, world!</h2> <!-- nested tag -->
    </p>This code is parsed and changed into:
    <p align="center">
    </p>
    <h2>Hello, world!</h2>Is there any possibility to get around this?
    Cheers,
    kelysar

    I do not know about how to treat HTML by JTextPane.
    According to http://www.w3.org/TR/html4/sgml/dtd.html,
    <!ENTITY % block
    "P | %heading; | %list; | %preformatted; | DL | DIV | NOSCRIPT |
    BLOCKQUOTE | FORM | HR | TABLE | FIELDSET | ADDRESS">
    So you cannot use h2 element in p element.
    Regards,

  • Font color issue with inserted HTML content in JTextPane (HTMLEditor)

    Hi everyone,
    I have a very serious issue with the HTMLEditor I'm developping. This editor is a little bit special since it is intended to edit blocks of HTML content that are loaded when the editor is initialized.
    You can in fact decide to keep this loaded HTML content or start a new HTML document from scratch. Alright, now my issue is the following :
    When text is loaded, it's properly rendered. I have a functionality which let's you see the HTML code from the HTML document used in the editor, so I can check and see if code is correct, and yes, it's correct.
    The problem is that when I try to change the color attribute of some text on my loaded content, nothing happens ! I don't know what's the matter with this bug, I only have it with the color attribute, with every other attribute everything's fine (font, size, etc.)
    The funny thing is that, after I change another attribute for loaded content, like font family, then changing color attribute funcionnality starts to work again !
    I've also noticed that I don't have any of these problems when I start my HTMLDocument from scratch (when I create a new HTML document and start typing text).
    Another weird thing, is that I have a feed-back feature in my editor which reflects attributes for text over which the caret is positionned. For example, if you put caret over red text, the color combo box displays a red value, you know, just like in MS Word. Well, with my loaded content if I have a red text color and I decide to put it in green, the color combo box displays the green value when I click over text for which I have changed color, but in my JTextPane it's still red !! And when I try to see the HTML code generated nothing has changed, everything is still red !
    There is something really strange here, this means that when I get the attributes of the loaded text from the HTMLDocument, color appears to be green, but when it gets rendered in the JTextPane it's still red and when it gets anlyzed to produce the corresponding HTML code, these changed attributes are not taken into account.
    But the most weird thing above all, is that I don't have this bug everytime, sometimes I start my HTML editor applet and it works fine, and some other times this color issue is bakc there. Is this a known bug for Swing API or not ?
    =============
    This is more or less my technique :
    //I declare a global reference to my HTMLDocument
    HTMLDocument _docHTMLDoc;
    //Create a JTextPane
    JTextPane _tpaEditor = new JTextPane( );
    //Set type content to automatically select HTMLEditorKit
    _tpaEditor.setContentType("text/html");
    //Get a referene to its HTMLEditorKit
    HTMLEditorKit _kitHTMLEditor = (HTMLEditorKit) _tpaEditor.getEditorKit( );
    //I then have a function to create new documents
    void newDocument(){
      _docHTMLDoc = (HTMLDocument) _kitHTMLEditor.createDefaultDocument();
      _tpaEditor.setDocument(_docHTMLDoc);
       //I do other stuff wich are not important to be shown here
    //I then have another function to load content
    void loadContent(){
       //I get content from a HashMap I initialized when I started my applet
       String strContent = (String)_mapInitParameters.get("html_content");
       //I set content for my editor
       _tpaEditor.setText(strContent);
    //Notice.. I have tried many other ways to load this text : via HTMLEditorKit and its insertHTML method, I
    //have also tried to store this content in some reader and make HTMLEditorKit read it... and nothing,
    // I always get the bug
    //To change color it goes like this :
    JComboBox _cboColor = new JComboBox();
    //I correctly initialize this combo with colors
    //then I do something like this
    ActionListener _lst = new ActionListener(){
       public void actionPeformed(ActionEvent e){
          Color colSel = (Color) _cboColor.getSelectedItem();
          MutableAttributeSet mas = new SimpleAttributeSet();
          StyleConstants.setForeground(mas,colSel);
          setAttributeSet(mas);
    _cboColor.addActionListener(_lst);
    //Set Attributes goes something like this
    private void setAttributeSet(javax.swing.text.AttributeSet atrAttributeSet) {       
            //Get current 'End' and 'Start' positions
            int intCurrPosStart = _tpaEditor.getSelectionStart();
            int intCurrPosEnd = _tpaEditor.getSelectionEnd();
            if(intCurrPosStart != intCurrPosEnd){
                //Apply attributes to selection
                _docHTMLDoc.setCharacterAttributes(intCurrPosStart,intCurrPosEnd - intCurrPosStart,atrAttributeSet,false);
            else{
                //No selection : apply attributes to further typed text
                MutableAttributeSet atrInputAttributes = _kitHTMLEditor.getInputAttributes();
                atrInputAttributes.addAttributes(atrAttributeSet);

    hi, friend!
    try this:
    void setAttributeToText(JTextPane pane, int start, int end, Color color) {
    MutableAttributeSet new_att = new SimpleAttributeSet();
    StyleConstants.setForeground(new_att,color);
    HTMLDocument doc=(HTMLDocument)pane.getDocument();
    doc.setCharacterAttributes(start,end,new_att,false);
    It works fine in my Application, hope will work in yours, too.
    good luck.

  • Insert HTML table into JTextPane

    hi people!
    I'm inserting htmltable in JTtextPane.
    The problem is, that borders aren't shown.
    they are shown in browser, the code in source view is also valid, but in JTextPane they ar invisible. Can anyone tell me Why?
    Here is a piece of code:
    public class HtmlTable {
    public static String insertTableString(int rows, int columns) {
    String tableString="<TABLE Width=100% Border=1>";
    for (int i=0; i<rows; i++) {
    tableString+="<TR>";
    for (int j=0; j<columns; j++)
    tableString+="<TD> </TD>";
    tableString+="</TR>";
    tableString+="</TABLE>";
    return tableString;
    call of this method:
    HTMLEditorKit kit;
    HTMLDoc=(HTMLDocument)editorTextPane.getStyledDocument();
    kit=(HTMLEditorKit)editorTextPane.getEditorKit();
    kit.insertHTML(HTMLDoc,editorTextPane.getCaretPosition(),HtmlTable.insertTableString(HtmlTable.getRowNumber(), HtmlTable.getColumnNumber()),0,0,HTML.Tag.TABLE);

    no Java code involved, just HTML and CSS
    <HTML>
    <HEAD>
    <style type="text/css">
    td {border-top-width:1pt; border-style:solid; }
    </style>
    </HEAD>
    <BODY>
    <p>
    Your Table goes here
    </p>
    <table>
    <tr>
    <td><p>Row 1 Col 1</p></td>
    <td><p>Row 1 Col 2</p></td>
    </tr>
    <tr>
    <td><p>Row 2 Col 1</p></td>
    <td><p>Row 2 Col 2</p></td>
    </tr>
    </table>
    </BODY>
    </HTML>

  • How to insert row in usercreat table(useing HTML tags)in jtextPane

    hi all
    i creat userdefined table in JTextPane like this
    tableBody.toString() -- iam passeing table tags
    htmlKit.insertHTML(htmlDoc, caretPos, tableBody.toString(), 0, 0, HTML.Tag.TABLE);
    i want to insert a row in table.. i did like this
    htmlKit.insertHTML(htmlDoc, caretPos, sRow.toString(), 0, 0, HTML.Tag.TR); it working..
    but it inserting in current location.. i want to insert ending of table...
    pls help me

    Hi,
    Follow the below logic,
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0001.
      MODULE POPULATE_TABLE_CONTROL. --> Get the data from table store in 
                                                                          ITAB
      LOOP AT GT_CTRL_LP_D516 INTO GS_WA_CTRL_LP_D516
           WITH CONTROL CTRL_LP_D516
           CURSOR CTRL_LP_D516-CURRENT_LINE.
      The following module moves data to control
        MODULE MOVE_TO_CONTROL.--> Move data from ITAB to table control
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT GT_CTRL_LP_D516.
      ENDLOOP.
      MODULE EXIT AT EXIT-COMMAND.
      MODULE USER_COMMAND_0001.  --> Here you have to take out the values from table control and update database table
    Reward points if helpful.
    Thanks and regards,
    Mallareddy Rayapureddy,
    Munich, Germany.

  • Extract text file with HTML tags from JTextPane

    hello world
    I have a big problem !
    I am creating an applet with a JTextPane ...
    so I can write text, (bold, italic etc), i can insert images.
    Now i want to create a text file with all the HTML tags
    corresponding to what I wrote in my JTextPane.
    I want to have and save the HTML file corresponding to what i wrote ...
    Is it possible ? Help me please ....
    Jeremie

    writing to a file from an applet is going to take a fair amount of work on your part.
    in order to write to a file from your applet, you have to use servlets or jsp to write to a file on your server. if you wish to write locally, look into signing your applet or policy settings of your browser.
    for writing to a file to the server, i suggest you look into servlets and tomcat to run the servlets.
    i just finished a project that used servlets and they take some time to figure out, but its definitely worth your time.
    here are some websites...
    http://www.j-nine.com/pubs/applet2servlet/Applet2Servlet.html
    http://jakarta.apache.org
    other websites have tutorials that you can look at too
    Andy

  • Appending HTML file.

    Hello Friends,
    i want to append a existing html file using jsp.
    At the end of the existing html file, i should have a textarea.
    if i enter sometext into that textarea, the text should be appended into the same html file.
    do u have any idea?.
    rgds
    tskarthikeyan

    There is nothing special in file operation in JSP/Servlet except file path. The way you read/write file from java application follow the same. Sample to read a file:
    FileReader reader=new FileReader("FileNameWithPath");
    BufferedReader buffer=new BufferedReader(reader);
    String text=null;
    while((text=buffer.readLine())!=null){
    FileWriter writer=new FileWriter("FileNameWithPath");
    BufferedWriter buffer=new BufferedWriter(writer);
    buffer.write("......");To get physical path of HTML file use following method of ServletContext:
    getRealPath(String path);The HTML content will be displayed in a JSP. When user clicks on submit button additional content goes to server side. At server side Servlet/JSP updates the html file content and finally displays the same (or other) JSP page with modified HTML content.
    Hope this helps.
    Thanks,
    Mrityunjoy

  • How Do i get HTML content of JTextPane

    I want formatted text
    i.e < b.>aaaaaaaaaaaaaa< / b >
    I am using it as an Editor.After that i want to save the edited content as formatted text.
    JTextPane.getText()--->Retrun only text -unformatted

    JTextPane.getText()--->Retrun only text -unformattedIt returns the HTML tags for me.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting

Maybe you are looking for

  • PDF portfolio similar to cs5_evalautionkit

    Hi, I am trying to create a pdf portfolio similar to cs5_evalautionkit. All the documents in the portfolio are pdf documents. I want the users to navigate pages through a button on the cover page (enter the document ) and then from a side menu to oth

  • New Fields on Service Ticket

    Hi Folks We are currently working on CRM 4.0. We have a new requirement where I need to add new fields to the Service Ticket. I added the new fields using EEWB and it works perfectly on SAP GUI. Now I need to add those new fields on CRM Webclient als

  • Can TestStand open, read, write and close binary files?

    From a TestStand sequence, I need to open, read, write and close binary files. Does TestStand support this capability?

  • Organizer 10 aborts

    Organizer 10 aborts on startup. So far I have downloaded the install files and did several re-installs of PSE 10 and Premiere Elements 10 with no good results. See error message below. PhotoshopElementsOrganizer.exe - Bad Image C:\Program Files\Adobe

  • Reduced content installed problem in Premiere 10

    Whenever I start Premiere 10, I get the message about reduced content is installed and since I downloaded my product I have downloaded the additional content and installed it to no avail i keep getting the message.  In Disc Menu I only show one selec