Integrating a Rich-text Widget with Struts

by Tim O'Brien

Related link: http://wiki.fckeditor.net/FCKeditor




The problem was straightforward, all I needed was a rich-text editor that would allow me to create XHTML that I could then send back to the client. I already had a textarea, and I just wanted a rich-text replacement. I thought this was going to be simple, but the problem cost me hours. In this entry, I show the process I used to identify a suitable AJAX/Javascript library, read on...




All this for pretty rich text editors, doesn't seem worth it.


18 Comments

jr@2ft
2006-02-23 12:13:37
Nice timing
Thanks so much for writing about this. These sort of things have always been on my "want" list for older apps, but I was going to have to use it for an upcoming app and was always fearful of that often multi-hour, multi-day frustration period of exploring different products. It's great that you condensed it into a short and easy to read introduction!
tmo9d
2006-02-23 12:38:16
Clarification
From Tim: "I realized that the article above leaves out some details. Realize that the struts form in question has a textarea: <html:textarea property="notes"/>. If I can grab a free hour from childcare, I'll throw a tarball together with a workign example."
iampivot
2006-02-23 19:04:43
TinyMCE
TinyMCE is another editor which is very configurable, easy to integrate, and has a very active community around it. http://tinymce.moxiecode.com
rks404
2006-02-23 20:30:38
my observations on Xinha
Great post - I've been struggling with integrating a wysiwyg tool into my web app and have found it to be an immensely frustrating experience. I'm definitely going to check out FCK.


I've been struggling with Xinha over the last week and am about to throw in the towel. I was initially quite impressed with it but I've had to deal with some absolutely ridiculous problems like corrupted html entities, mangled links, an indentation style that drives IE insane and a couple of other things. All of this has ruined the confidence of the customer and myself in the ability of this product to maintain the integrity of the data.


To be fair, it does have a lot of good points, it generates good XHTML and the performance is good. Unfortunately, configuration can be quite a bear. The Xinha support forums are littered with people asking for help and not much help is forthcoming.


Ah, that turned into a rant. Sorry about that. I'm sure Xinha is great for a lot of uses, just not mine.

tmo9d
2006-02-23 20:41:38
my observations on Xinha
Interesting, in general I think the frustration with these rich-text components is universal. What's crazy about rich editors is the amount of collective stress we've all spent trying to integrate them into our applications. I think it just points to the fact tht the intersection of browsers, Javascript, and server-side applications is still a blind spot irregargless of Web2.0


...before someone chimes in with the obligatory "In rails everything is easy" message. I'll point to the fact that integrating rails and FCKeditor is a chore (http://www.joshuamcharles.com/rails/fckeditor.html) .

ktiedt
2006-02-25 18:45:48
regarding Dojo
I believe you would have found that had you emailed the mailing list with your issue, your time spent on Dojo would have been significantly less. Yes I know, you shouldn't have to, but on a project with documentation in development, it's a great substitute. To give you a hand, I believe these following tips will solve your problems with Dojo in your situation.


1) http://dojo.jot.com/FAQ#Debugging%20on%20Firefox


This link in our FAQ explains how to force Dojo to cooperate with Venkman for debugging purposes.


2) For your problem with dojo.require using the wrong file paths





This would need to be defined before your



before anything. and it works.


However, when I use the dialog widget to collect more adhoc info from the form. Very weird thing happened, and I still haven't got the chance to figure out why yet. Whatever I input in the dialog form element are not been submitted to the httpservletrequest object in my controller. And I am pretty sure this is dojo issue, because when i removed the widget, everything works fine.


Anyway, I am moving to use fck for now, because of the internalization feature. TinyMce is great too.



Naive
2006-12-28 06:17:14
Thank you for this article. One thing i'm noticing is that "Karl's" post is not appearing (along with several after his) - the one with the explanation of the misunderstanding/fix to your article above.


I just happened to see it when i did a 'view source' on this page because the comment starting with "regarding dojo" seemed to be missing some sentences (that i thought might have been code that didn't render properly).


Thought you'd might want to get that fixed :)

David Li
2006-12-28 21:56:09
Thank you for point that out. I pasted part of the javascript code in there and that doesn't seem to be rendered properly. But a view source on page will do it.
test
2007-01-11 04:47:14