Simone - Dev wrote:

Hello all,
I'm in a team of open source developer for an HTML editing control to be
included in web pages to enable the posting of rich formatted text using
a visual approach (instead of typing HTML in a textarea)
The project is http://www.fredck.com/fckeditor/ and u can see a working
demo (works for the moment just on IE 5+ and windows) here
http://www.fredck.com/fckeditor/Demo/


What I'm writing here becase I've just developed (and will be released in the next version of the editor, hopefully next weekend) a taglib to include this control in a JSP page with a simple <FCK:editor id="bodyNews" >Text of the news </FCK:editor> instead of writing all the complex javascript code required to the make the html editor start.

But in the next version I want to go further, and have the editor get
it's initial value from the FormBean connected with the form and then
set it so that the following action can retrieve it inside the FormBean
passed by the page.

Basically the editor store the text to edit (and then to be sent in the
post method) in an hidden field, and one of the things that my taglib
does is also to write this hidden field with the "starting" value.

But I never extended an HTML taglib, and never found on the archive nor
other websites some info on how to do it.
Thank you for ur help.



Simone,

From a Struts perspective, what you're describing sounds pretty similar to the <html:textarea> tag ... it's just that the editing would be rich text instead of simple characters, right? If so, and if you wanted to be able to interoperate with Struts capabilities, you should download the source code for Struts [1], and take a look at how the corresponding tag itself is implemented (org.apache.struts.taglib.html.TextareaTag). The simplest thing to do would be cut-n-paste this into a separate tag file, instead of worrying about extending it. Most of the things you would need to change are in the renderTextareaElement() method.

With regards to form bean interaction, I am assuming that the form bean would treat the content of the editing area as a String, right? If so, then BaseInputTag (which TextareaTag subclasses) does most of the work for you. Just make sure your tag includes the same kinds of attributes as <html:textarea> (but especially "name", "property", and "value"), plus any additional ones you need, and your renderTextareaElement() will be able to interact with the "value" instance variable.

Craig McClanahan


[1] http://jakarta.apache.org/site/sourceindex.cgi


PS: In addition to interoperating with Struts, you might want to investigate creating a JavaServer Faces component around your text editor. This sounds like a very useful gadget. More info:

http://java.sun.com/j2ee/javaserverfaces/






Simone

-------------------------
Simone Chiaretta
<http://www.piyosailing.com/S> www.piyosailing.com/S
Any sufficiently advanced technology is indistinguishable from magic
"Life is short, play hard"






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to