textArea for RTF input/output

I'm building a web app using Struts/JSP.

I need to provide textArea where users can format their input.  I'd like to have the buttons with formatting functions such as font, bold, italic, etc.
When user clicks submit, I need to save the RTF formatted string in database.
For example, if user enter "hello" and format it italic...
then, I need to grab the string

{\rtf1\ansi\ansicpg949\deff0\deflang1033\deflangfe1042{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\i\f0\fs20 hello\i0\par
}

( \ is backslash )

Also, when I pull this from database, I need to display it as italic "hello"
Any ideas/suggestions? Thanks.

derilischeAsked:
Who is Participating?
 
Tommy BraasConnect With a Mentor Commented:
>> I'm using JSP/Struts, and don't want to use applet.  
You mean you're using HTML.

>> Is there any other way?
Sure, JavaScript and CSS.
0
 
Tommy BraasCommented:
Use a javax.swing.JEditorPane with a javax.swing.text.rtf.RTFEditorKit.
0
 
Tommy BraasCommented:
You can then call getText() on the JEditorPane to get the RTF content, and conversely setText() to set the RTF content of the component.
0
 
derilischeAuthor Commented:
I'm using JSP/Struts, and don't want to use applet.  
Is there any other way?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.