Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Inserting preformatted html text

843805May 7 2007 — edited May 7 2007
Hello,

I am writing an application to edit some preformatted html text, entered in a html TEXTAREA. I know that html text break lines with '%0D%0A', but how do I insert some preformatted text into JEditorPane without writing code to search for this?

I have tried

String HTMLInput = getParameter("TEXTAREA_INPUT");

htmlEditorKit.insertHTML(htmlDocument, 0, HTMLInput, 0, 0, HTML.Tag.PRE);

and StringBuffer.readLine() to find the new lines so that I could replace them with '\n' but this doesn't work either.

I have to use JEditorKit because my application is already written using that so using JTextPane is out of the question.

Any ideas? I can send you some sample code if you would like to see the problem in action. It is in three files because I need a form to get the input, a JSP that has an <object> tag that passes a param to the applet containing the JEditorPane

Message was edited by:
jasinner
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2007
Added on May 7 2007
0 comments
217 views