Use of FCKeditor online editor

Source: Internet
Author: User
Tags tld
1. Download
FCKeditor. Java 2.3 (fckeditot for Java)
FCKeditor 2.2 (FCKeditor basic file)

2. Create a project: tomcat/webapps/testfckeditor.

3. Decompress fckeditor2.2 and copy the entire FCKeditor directory to the root directory of the project,
Directory structure: tomcat/webapps/testfckeditor/FCKeditor
Then copy the two jar files in the \ WEB \ WEB-INF \ Lib \ directory of the fckeditor-2.3.zip (Java) Compressed package to the \ WEB-INF \ Lib \ directory of the project. Copy the FCKeditor. TLD file under the src directory to testfckedit/fckeitor/WEB-INF /.

4.merge the Web. xml file in the \ WEB \ WEB-INF \ directory of the fckeditor-2.3.zip package into the web. xml file under the \ WEB-INF \ directory of the project.

5. Modify the merged web. xml file and change the enabled parameter value of the servlet named simpleuploader to true,
To allow upload. The basedir parameter value of servlet ctor servlet is used to set the location where the uploaded files are stored.
Add Tag definition:
<Taglib>
<Taglib-Uri>/testfckeditor </taglib-Uri>
<Taglib-location>/WEB-INF/FCKeditor. TLD </taglib-location>
</Taglib>

6. The mappings between the two servlets in the above file are:/Editor/filemanager/Browser/default/connectors/JSP/connector.
And/Editor/filemanager/upload/simpleuploader, you need to add/FCKeditor before the two mappings,
Change to/FCKeditor/Editor/filemanager/Browser/default/connectors/JSP/connector and
/FCKeditor/Editor/filemanager/upload/simpleuploader.

7. Enter the skin folder. If you want to use the default FCKeditor milk yellow,
Delete the other two folders except the default folder.

8. Delete all files except fckconfig. JS, FCKeditor. JS, fckstyles. XML, and fcktemplates. XML in the/FCKeditor/directory.
Delete directory/Editor/_ source,
Delete all files under/Editor/filemanager/Browser/default/connectors/
Delete all files under/Editor/filemanager/upload/
Delete all files under/Editor/lang/Except for fcklanguagemanager. JS, en. JS, Zh. JS, zh-cn.js 4 files

9. Open/FCKeditor/fckconfig. js
Modify fckconfig. defaultlanguage = 'zh-cn ';
Replace the values of fckconfig. linkbrowserurl with the following:
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 ";

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 ';

10. Others
Fckconfig. js configuration file, which can be opened in the log book. After modification, the file will be saved as UTF-8 encoding format. Find:

Change fckconfig. tabspaces = 0; To fckconfig. tabspaces = 1; that is, you can use the tab key in the editor.

If your editor is still used at the front-end of the website, for example, when it is used for message book or diary reply, you have to consider security,
Do not use the default toolbar on the front-end, either customize the function or use the basic defined by the system,
That is, the basic toolbar. Find:
Fckconfig. toolbarsets ["Basic"] = [
['Bold ', 'italic', '-', 'orderedlist', 'unorderedlist', '-',/* 'link', */'unlink ', '-', 'style', 'fontsize', 'textcolor', 'bgcolor ','-',
'Smilil', 'specialchar ', 'replace', 'preview'];
This is a modified basic. Remove the image function and the Add link function, because the image and link and flash and image button add function can make the foreground
Page to directly access and upload files. FCKeditor also supports the right-click function in the editing area.

Fckconfig. contextmenu = ['generic',/* 'link', */'anchor ',/* 'image', */'flash', 'select', 'textarea ', 'checkbox', 'Radio ', 'textfield', 'hiddenfield ',
/* 'Imagebutton ', */'button', 'bulletedlist', 'numberedlist', 'tablecell ', 'table', 'form'];

This is also a change to remove the "link, image, Flash, image button" function of the right mouse button.

Find: fckconfig. fontnames = 'arial; Comic Sans MS; Courier New; tahoma; Times New Roman; verdana ';
Add several common Fonts
Fckconfig. fontnames
= '; _ Gb2312; Arial; Comic Sans MS; Courier New; tahoma; Times New Roman; verdana ';

7. add page

<% @ Page Language = "Java" Import = "com. fredck. FCKeditor. *" %>
<% @ Taglib uri = "/WEB-INF/TLDs/FCKeditor. TLD" prefix = "fck" %>
<SCRIPT type = "text/JavaScript" src = "FCKeditor/FCKeditor. js"> </SCRIPT>

<Form action = "show. jsp" method = "Post" target = "_ blank">
<Table border = "0" width = "700"> <tr> <TD>
<Textarea id = "content" name = "content" style = "width: 100%; Height: 400px"> input </textarea>
<SCRIPT type = "text/JavaScript">
VaR ofckeditor = new FCKeditor ('content ');
Ofckeditor. basepath = "FCKeditor /";
Ofckeditor. Height = 400;
Ofckeditor. toolbarset = "default ";
Ofckeditor. replacetextarea ();
</SCRIPT>
<Input type = "Submit" value = "Submit">
</TD> </tr> </table>
</Form>

Edit the Web. xml collection and add the following parts:

<Servlet>
<Servlet-Name> simpleuploader </servlet-Name>
<Servlet-class> com. fredck. FCKeditor. uploader. simpleuploaderservlet </servlet-class>
<Init-param>
<Param-Name> basedir </param-Name>
<Param-value>/userfiles/</param-value>
</Init-param>
<Init-param>
<Param-Name> debug </param-Name>
<Param-value> true </param-value>
</Init-param>
<Init-param>
<Param-Name> enabled </param-Name>
<Param-value> false </param-value>
</Init-param>
<Init-param>
<Param-Name> allowedextensionsfile </param-Name>
<Param-value> </param-value>
</Init-param>
<Init-param>
<Param-Name> deniedextensionsfile </param-Name>
<Param-value> PHP | php3 | PhP5 | phtml | ASP | aspx | ascx | JSP | CFM | CFC | PL | bat | exe | DLL | Reg | CGI </param- value>
</Init-param>
<Init-param>
<Param-Name> allowedextensionsimage </param-Name>
<Param-value> JPG | GIF | JPEG | PNG | BMP </param-value>
</Init-param>
<Init-param>
<Param-Name> deniedextensionsimage </param-Name>
<Param-value> </param-value>
</Init-param>
<Init-param>
<Param-Name> allowedextensionsflash </param-Name>
<Param-value> SWF | FLA </param-value>
</Init-param>
<Init-param>
<Param-Name> deniedextensionsflash </param-Name>
<Param-value> </param-value>
</Init-param>
<Load-on-startup> 1 </load-on-startup>
</Servlet>

<Servlet-mapping>
<Servlet-Name> connector </servlet-Name>
<URL-pattern>/FCKeditor/Editor/filemanager/Browser/default/connectors/JSP/connector </url-pattern>
</Servlet-mapping>

<Servlet-mapping>
<Servlet-Name> simpleuploader </servlet-Name>
<URL-pattern>/FCKeditor/Editor/filemanager/upload/simpleuploader </url-pattern>
</Servlet-mapping>

<Taglib>
<Taglib-Uri>/WEB-INF/FCKeditor. TLD </taglib-Uri>
<Taglib-location>/WEB-INF/TLDs/FCKeditor. TLD </taglib-location>
</Taglib>

OK!

Original: http://www.blogjava.net/myblogs/archive/2006/06/28/55533.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.