?
Solved

textArea for RTF input/output

Posted on 2006-05-22
6
Medium Priority
?
505 Views
Last Modified: 2006-11-18
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.

0
Comment
Question by:derilische
  • 3
4 Comments
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 16740298
Use a javax.swing.JEditorPane with a javax.swing.text.rtf.RTFEditorKit.
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 16740357
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
 

Author Comment

by:derilische
ID: 16747376
I'm using JSP/Struts, and don't want to use applet.  
Is there any other way?
0
 
LVL 14

Accepted Solution

by:
Tommy Braas earned 2000 total points
ID: 16747742
>> 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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question