Pre-work preparation
The version is Fckeditor_2.4.2.zip "component's Master Package", Fckeditor.java 2.3.zip "which provides a tag library and a picture upload jar". These can be downloaded to the Http://www.fckeditor.net website!
Configuration
1. New Project Compass, create a new folder under the Webroot folder FCKeditor (used to store fckeditor related files,
Remember to match the case, because if you need to change the file is more, and not sure whether the change is complete
2. The Editor folder in the fckeditor_2.4.2 package and Fckconfig.js, Fckeditor.js, Fckstyles.xml, Fcktemplates.xml
These four files are placed in the FCKeditor directory in the project.
3. Add two jar files under Webweb-inflib in the Fckeditor.java-2.3.zip package to the Webrootweb-inflib directory of the Project
4. fckeditor.tld files under SRC in the Fckeditor.java-2.3.zip package to the Webrootweb-inf directory of the Project
5. Create a new Userfiles folder under the WebRoot directory, under which you can create new image, Flash, file, media four folders, which are used to store uploaded pictures, animations, files, press files, respectively.
6. Modify the Fckconfig.js component configuration file "Explain that you can search for information in the configuration file before the equal sign to make a change:
A, Fckconfig.skinpath = Fckconfig.basepath + ' skins/silver/';
This is the component's style template to determine exactly what style you need to use, which changes according to your own preferences,
B, fckconfig.defaultlanguage = ' ZH-CN ';
This is to determine which language you need to use, set the above expression to use Simplified Chinese;
C, change the path of file browsing:
Fckconfig.linkbrowserurl = Fckconfig.basepath + "filemanager/browser/default/browser.html?" Connector=connectors/jsp/connector ";
Fckconfig.imagebrowserurl = Fckconfig.basepath + "filemanager/browser/default/browser.html?" Type=image&connector=connectors/jsp/connector ";
Fckconfig.flashbrowserurl = Fckconfig.basepath + "filemanager/browser/default/browser.html?" Type=flash&connector=connectors/jsp/connector ";
Shielding the corresponding information, using the above
D, change the path of the uploaded file
Fckconfig.linkuploadurl = Fckconfig.basepath + ' Filemanager/upload/simpleuploader? Type=file ';
Fckconfig.flashuploadurl = Fckconfig.basepath + ' Filemanager/upload/simpleuploader? Type=flash ';
Fckconfig.imageuploadurl = Fckconfig.basepath + ' Filemanager/upload/simpleuploader? Type=image ';
Shielding the corresponding information, using the above
7. Modify the Web.xml file and add the following content:
There is a webweb-infweb.xml in the Fckeditor.java-2.3.zip package that copies the contents of this node to the corresponding location in your project, which is worth noting:
<servlet-name>Connector</servlet-name>
<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<!--This is a file browsing path, you can only choose to modify, but remember not to change to "/[Engineering name]/userfiles/"
Because he is currently running in the root of the project, so if you want to browse the default directory of files as
Webrootupload directory, the need to change into:/upload/, you can-->
<param-value>/UserFiles/</param-value>
</init-param>
<init-param>
<servlet-name>SimpleUploader</servlet-name>
<servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<!--This is the file upload path, you can only choose to modify, but remember not to change to "/[Engineering name]/userfiles/"
Because he is currently in the root of the project to run down, so if you want to put the uploaded files in the Webrootupload directory,
The need to change into:/rpload/, you can-->
<param-value>/UserFiles/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<!--Remember to change here, to change false to true, this is whether to enable upload function-->
<param-name>enabled</param-name>
<param-value>true</param-value>
</init-param>
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>
/fckeditor/editor/filemanager/browser/default/connectors/jsp/connector
</url-pattern>
</servlet-mapping>
<!--Don't forget the code--> the bold section above and below
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>
</servlet-mapping>
Optimization
These are the components embedded into the project configuration process, below we will optimize the component compression, the useless files are removed:
Delete all the files in the Webrootfckeditoreditorfilemanagerbrowserdefaultconnectors directory, these are used to browse the file, for JSP words are using a servlet to deal with, So these files are redundant.
Delete all files in the Webrootfckeditoreditorfilemanagerupload directory
Remove unwanted languages from the Webrootfckeditoreditorlang directory, such as retaining Chinese "zh-cn.js" and English [en.js] and Fcklanguagemanager.js files
Remove unwanted skin files from the Webrootfckeditoreditorskins directory, with three skins that can be deleted as needed
Using on a JSP page
★ First in the TEST.JSP page header plus label using the statement "Do not need to do directory adjustment, has been feasible":
★ Then in the corresponding position of the page to increase the call statement, for the FCK tag, which can also add a lot of attributes, of course, you can not add, pay attention to the following bold, I use the following 2 more commonly used properties, one is the height of the adjustment, the other is the component style
This is FCKeditor demo!
★ Receive parameters can be written like this
Other
1, fckconfig.js general configuration file, can be used to open, modified to save the file as a UTF-8 encoding format. Found it:
fckconfig.tabspaces = 0; Changed to Fckconfig.tabspaces = 1; That is, you can use the TAB key in the Editor field.
2, if your editor is also used in the Web site, for example, for message book or diary reply, then have to consider security
, do not use the toolbar of default in the foreground, or customize the function, or use the system has already defined basic, that is, the basic toolbar, find:
fckconfig.toolbarsets["Basic"] = [
[' Bold ', ' Italic ', '-', ' orderedlist ', ' unorderedlist ', '-', * ' Link ', ' Unlink ', ' ', ' Style ', ' fontsize ', ' textcolor ', ' BgColor ', '-', ' smiley ', ' Specialchar ', ' Replace ', ' Preview '];
This is changed basic, the image function is removed, the Add link function is removed, because the image and link and flash and image button Add function can let the front page directly access and upload files, FCKeditor also supports the editing of the right mouse button in the domain function.
Fckconfig.contextmenu = [
' Generic ',/* ' Link ',/' Anchor ',/* ' Image ', */' Flash ', ' Select ', ' Textarea ', ' Checkbox ',
' Radio ', ' TextField ', ' HiddenField ',/* ' ImageButton ', ' Button ', ' bulletedlist ',
' Numberedlist ', ' TableCell ', ' Table ', ' Form '];
This is also changed the right mouse button "link, image, FLASH, image button" features are removed.
3, find: Fckconfig.fontnames =
' Arial; Comic Sans MS; Courier New; Tahoma; Times New Roman; Verdana ';
Plus a few of our common fonts:
Fckconfig.fontnames = ' song body; bold; official script; italics _gb2312; Arial; Comic Sans MS;
Courier New; Tahoma; Times New Roman; Verdana ';
4, note that the file name can not be uploaded in Chinese, otherwise can not be normal display or link download.