WYSIWYG editor in Java web applications
A tutorial on how to add wysiwyg editor in java web applications
There are definitely many fine editors that can be easily integrated into java-based web applications but one of the most widely used and well known editors is surely FCK editor -CKEditor now-.There has been created a tag library for CKEditor called FCKeditor.Java Integration and in this tutorial we will see how to use this tag library in your JSPs and how to upload image files etc through CKEditor.
As a first step in order to use CKEditor -and apart from downloading the appropriate jars- we need to add the taglib uri in the jsp.
<%@ tagliburi="http://java.fckeditor.net" prefix="FCK" %>
Now that the taglib uri is set we can use CKEditor by creating an instance.This is done as shown in the below snippet:
<FCK:editor instanceName="summary" width="700" height="300"> </FCK:editor>
Apart from the attributes shown above,there are several others that will let you set the bath to the folder of the editor – basepath- the name of the input field – inputName-,the editor's toolbar set you want to use etc.
In case you need to change , for example, the editor's skin or some other general attributes, you can do this by using
tag.For example,if you need to define the allowed file extentions for image uploading:
In this page you can find the complete list of the attributes you can modify. Finally if you want to enable file uploading in CKEditor all you have to do is to declare the connector servlet in your web application's web.xml
ConnectorServlet</servlet-name> <servlet-class> net.fckeditor.connector.ConnectorServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> ... <servlet-mapping> <servlet-name>ConnectorServlet</servlet-name> <url-pattern> /fckeditor/editor/filemanager/connectors/* </url-pattern> </servlet-mapping>
Copyright © 2012 Design and Development Nikos Lianeris