`

FCKeditor在线编辑器

    博客分类:
  • Web
阅读更多

FCKeditor在线编辑器
FCKeditor 这个开源的HTML 文本编辑器可以让web 程序拥有如MS Word 这样强大的编辑功
FCKeditor官司方网址:http://www.fckeditor.net/

FCKeditor在线DEMO:http://www.fckeditor.net/demo

FCKeditor下载直址:http://www.fckeditor.net/download 最新版已经是2.6了。

在项目中使用FCKeditor在线编辑器:
(1) 新建一个WEB工程;
(2) 解压FCKeditor_2.6.zip包,将其中的editor文件夹复制到项目中去;
(3) 解压FCKeditor_2.6.zip包,将其中的fckconfig.js、fckeditor.js、fckstyles.xml、fcktemplates.xml赋值到项目中的WebRoot目录下面;
(4) 将FCKeditor.jar文件复制到WebRoot\WEB-INF\lib目录;
(5) 将FCKeditor.tld文件复制到WEB-INF下面;
(6) 修改web.xml配置文件中的信息,如下;
<!-- fckeditor start -->

Java代码 复制代码
  1. <servlet>  
  2.          <servlet-name>Connector</servlet-name>  
  3.          <servlet-class >  
  4.              com.fredck.FCKeditor.connector.ConnectorServlet  
  5.          </servlet-class >  
  6.          <init-param>  
  7.              <param-name>baseDir</param-name>  
  8.              <param-value>/UserFiles/</param-value>  
  9.          </init-param>  
  10.          <init-param>  
  11.              <param-name>debug</param-name>  
  12.              <param-value>true </param-value>  
  13.          </init-param>  
  14.          <load-on-startup>1 </load-on-startup>  
  15.      </servlet>  
  16.      <servlet>  
  17.          <servlet-name>SimpleUploader</servlet-name>  
  18.          <servlet-class >  
  19.              com.fredck.FCKeditor.uploader.SimpleUploaderServlet  
  20.          </servlet-class >  
  21.          <init-param>  
  22.              <param-name>baseDir</param-name>  
  23.              <param-value>/UserFiles/</param-value>  
  24.          </init-param>  
  25.          <init-param>  
  26.              <param-name>debug</param-name>  
  27.              <param-value>false </param-value>  
  28.          </init-param>  
  29.          <init-param>  
  30.              <param-name>enabled</param-name>  
  31.              <param-value>true </param-value>  
  32.          </init-param>  
  33.          <init-param>  
  34.              <param-name>AllowedExtensionsFile</param-name>  
  35.              <param-value></param-value>  
  36.          </init-param>  
  37.          <init-param>  
  38.              <param-name>DeniedExtensionsFile</param-name>  
  39.              <param-value>  
  40.                  php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi  
  41.              </param-value>  
  42.          </init-param>  
  43.          <init-param>  
  44.              <param-name>AllowedExtensionsImage</param-name>  
  45.              <param-value>jpg|gif|jpeg|png|bmp</param-value>  
  46.          </init-param>  
  47.          <init-param>  
  48.              <param-name>DeniedExtensionsImage</param-name>  
  49.              <param-value></param-value>  
  50.          </init-param>  
  51.          <init-param>  
  52.              <param-name>AllowedExtensionsFlash</param-name>  
  53.              <param-value>swf|fla</param-value>  
  54.          </init-param>  
  55.          <init-param>  
  56.              <param-name>DeniedExtensionsFlash</param-name>  
  57.              <param-value></param-value>  
  58.          </init-param>  
  59.          <load-on-startup>1 </load-on-startup>  
  60.      </servlet>  
  61.    <servlet>  
  62.      <description>This is the description of my J2EE component</description>  
  63.      <display-name>This is the display name of my J2EE component</display-name>  
  64.      <servlet-name>PostArticle</servlet-name>  
  65.      <servlet-class >servlet.PostArticle</servlet- class >  
  66.    </servlet>  
  67.   
  68.   
  69.      <servlet-mapping>  
  70.          <servlet-name>Connector</servlet-name>  
  71.          <url-pattern>  
  72.              /FCKeditor/editor/filemanager/browser/default /connectors/jsp/connector  
  73.          </url-pattern>  
  74.      </servlet-mapping>  
  75.      <servlet-mapping>  
  76.          <servlet-name>SimpleUploader</servlet-name>  
  77.          <url-pattern>  
  78.              /FCKeditor/editor/filemanager/upload/simpleuploader  
  79.          </url-pattern>  
  80.      </servlet-mapping>  
  81.    <servlet-mapping>  
  82.      <servlet-name>PostArticle</servlet-name>  
  83.      <url-pattern>/servlet/post</url-pattern>  
  84.    </servlet-mapping>  
<servlet>   <servlet-name>Connector</servlet-name>   <servlet-class>    com.fredck.FCKeditor.connector.ConnectorServlet   </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>false</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>     <description>This is the description of my J2EE component</description>     <display-name>This is the display name of my J2EE component</display-name>     <servlet-name>PostArticle</servlet-name>     <servlet-class>servlet.PostArticle</servlet-class>   </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>   <servlet-mapping>     <servlet-name>PostArticle</servlet-name>     <url-pattern>/servlet/post</url-pattern>   </servlet-mapping>

<!-- fckeditor end -->


(7) 在JSP页面中使用,如:test.jsp
首先要在报头中加入

Java代码 复制代码
  1. <%@ taglib uri= "http://fckeditor.net/tags-fckeditor" prefix= "f" %>  
<%@ taglib uri="http://fckeditor.net/tags-fckeditor" prefix="f"%>

还要注意basepath及path的设置

Java代码 复制代码
  1. <%  
  2. String path = request.getContextPath();  
  3. String basePath = request.getScheme()+"://" +request.getServerName()+ ":" +request.getServerPort()+path+ "/" ;  
  4. %>  
  5.   
  6.    <body>  
  7.      <form action="servlet/post" method= "post" >  
  8.          title:<input type="text" name= "title" ><br>  
  9.          <f:editor id="content"    basePath= '<%=path + "/FCKeditor/"%>'   
  10.                  imageBrowserURL='<%=path  
  11.                              + "/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector" %>'  
  12.                  linkBrowserURL='<%=path  
  13.                              + "/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector" %>'  
  14.                  flashBrowserURL='<%=path  
  15.                              + "/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector" %>'  
  16.                  imageUploadURL='<%=path  
  17.                              + "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image" %>'  
  18.                  linkUploadURL='<%=path  
  19.                              + "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File" %>'  
  20.                  flashUploadURL='<%=path  
  21.                              + "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash" %>'>  
  22.           
  23.           
  24.              </f:editor>  
  25.              <input type="submit" >  
  26.      </form>  
  27.    </body>  
<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>    <body>     <form action="servlet/post" method="post">      title:<input type="text" name="title"><br>      <f:editor id="content"  basePath='<%=path + "/FCKeditor/"%>'     imageBrowserURL='<%=path        + "/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"%>'     linkBrowserURL='<%=path        + "/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"%>'     flashBrowserURL='<%=path        + "/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"%>'     imageUploadURL='<%=path        + "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"%>'     linkUploadURL='<%=path        + "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"%>'     flashUploadURL='<%=path        + "/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash"%>'>          </f:editor>    <input type="submit">     </form>   </body>

 

分享到:
评论

相关推荐

    fckeditor在线编辑器

    4. 使用`ReplaceTextarea()`方法将原有的多行文本框替换为FCKeditor编辑器。 如果需要实现图片上传功能,还需要以下步骤: 1. 引入必要的Java库文件,包括fckeditor-java-core-2.4.1.jar(FCKeditor核心)、commons...

    FckEditor在线编辑器

    FckEditor是一款强大的开源在线文本编辑器,广泛应用于网站建设和内容管理系统中,为用户提供类似桌面文字处理软件的编辑体验。它的全称为“FCKeditor”,最初由Fernando Goycoolea创建,后来更名为CKEditor。这款...

    FCKeditor在线编辑器(表情qq2008)

    **FCKeditor在线编辑器(表情qq2008)** FCKeditor是一款开源的、功能强大的HTML在线编辑器,广泛应用于网站内容管理系统(CMS)和论坛等需要用户编辑和发布文本的地方。它允许用户通过类似Word的界面来编辑网页内容...

    fckeditor 在线编辑器

    **fckeditor 在线编辑器详解** fckeditor是一款广泛使用的开源在线文本编辑器,它为Web应用程序提供了丰富的文本格式化功能,使得用户可以在浏览器环境中编辑HTML内容如同在桌面应用中一样方便。这款编辑器以其易用...

    FCKeditor 在线编辑器

    **FCKeditor在线编辑器** 是一款开源的富文本编辑器,广泛应用于Web开发中,为用户提供类似桌面文字处理软件的界面,使用户在网页上能够进行格式化文本的编辑。这款编辑器以其易用性、灵活性和强大的功能集而闻名,...

    FCKEditor在线编辑器

    **FCKEditor在线编辑器详解** FCKEditor是一款开源的富文本编辑器,它为Web开发者提供了一种在网页上创建、编辑复杂内容的强大工具。这个编辑器支持多种浏览器,包括Internet Explorer、Firefox、Chrome、Safari等...

    基于Java Web的HTML在线文本编辑器解决方案——以FckEditor在线编辑器为例.pdf

    FckEditor在线编辑器在Java Web开发中应用非常广泛,成为开发者首选的在线编辑器。FckEditor提供了文本样式编辑、图片上传下载和附件上传下载等功能,为网络文本交互提供了强大支持。 知识点3:FckEditor在线编辑器...

    php版FCKEDITOR在线编辑器

    FCKEditor是一款著名的开源富文本编辑器,它为用户提供了类似于Microsoft Word的在线编辑体验。在Web开发中,FCKEditor常被用于创建论坛、博客或其他内容管理系统(CMS)的后台编辑界面,让用户能够方便地编辑和格式...

Global site tag (gtag.js) - Google Analytics