1. log on firstWww.fckeditor.net/downloadTo download the latest FCKeditor version, you need to download two packages: one is the basic application and the other is the configuration prepared for the JSP.
FCKeditor 2.6: sourceforge.net/project/downloading.php
FCKeditor. Java: sourceforge.net/project/downloading.php
After the download, decompress the fckeditor_2.6.zip and the FCKeditor-2.3.zip respectively.
2. Create a new project under eclipse, for example, testHttp: // localhost: 8080/test
Create a folder FCKeditor in the project, and copy the decompressed fckeditor_2.6 files to the FCKeditor, fckconfig. JS, FCKeditor. JS, fckstyles. XML, and fcktemplates. xml files to the FCKeditor directory.
Copy the packages under Web/FCKeditor-2.3/lib in the decompressed WEB-INF folder to the Lib of the test project.
Copy FCKeditor. TLD under src in the FCKeditor-2.3 folder to the WEB-INF under the test project.
3. modify web. xml under the WEB-INF, as follows:
<Servlet>
<Servlet-Name> connector </servlet-Name>
<Servlet-class> com. fredck. FCKeditor. connector orservlet </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>
<Load-on-startup> 1 </load-on-startup>
</Servlet>
<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> true </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>
4. Modify FCKeditor. js in the FCKeditor folder.
Modify FCKeditor. basepath of row 50th.
After modification:
50 FCKeditor. basepath = 'fckeditor /';
5. Modify fckconfig. js in the FCKeditor folder.
Modify fckconfig. defaultlanguage, fckconfig. linkbrowserurl, fckconfig. imagebrowserurl, fckconfig. flashbrowserurl,
After modification:
Fckconfig. defaultlanguage = 'zh-cn ';
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. imageuploadurl = fckconfig. basepath + 'filemanager/upload/simpleuploader? Type = image ';
Fckconfig. flashuploadurl = fckconfig. basepath + 'filemanager/upload/simpleuploader? Type = flash ';
6. The content of default. jsp is as follows:
<% @ Page contenttype = "text/html; charset = gb2312" Language = "Java" Import = "Java. SQL. *" errorpage = "" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> FCKeditor test </title>
<SCRIPT type = "text/JavaScript" src = "FCKeditor/FCKeditor. js"> </SCRIPT>
</Head>
<Body>
<Form ID = "form1" name = "form1" method = "Post" Action = "default_do.jsp">
<Table width = "100%" border = "0">
<Tr>
<TD Height = "25">
<Textarea name = "contest" id = "contest" style = "width: 100%; Height: 400px;"> </textarea>
<SCRIPT type = "text/JavaScript">
VaR ofckeditor = new FCKeditor ('test ');
// Ofckeditor. basepath = 'fckeditor /';
Ofckeditor. toolbarset = 'default ';
Ofckeditor. width = '000000 ';
Ofckeditor. Height = '20140901 ';
Ofckeditor. value = '';
Ofckeditor. replacetextarea ();
// Ofckeditor. Create ();
</SCRIPT>
<Input type = "Submit" name = "Submit" value = "Submit"/>
</TD>
</Tr>
</Table>
</Form>
</Body>
</Html>
7. The content of default_do.jsp is as follows:
<% @ Page contenttype = "text/html; charset = gb2312" Language = "Java" Import = "Java. SQL. *" errorpage = "" %>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> receiving result of FCKeditor test </title>
</Head>
<Body>
<%
String contest = new string (request. getparameter ("contest"). getbytes ("iso8859_1"), "gb2312 ");
Out. Print (contest );
%>
</Body>
</Html>
Last test:HTTP: /localhost: 8080/test/Default. jsp
Figure 1:
Figure 2: