使用Fckeditor

1、导入相应jar

  2、将fredck.FCKeditor的包放置到对应目录下(src下的cn.itcast

  3、将fckeditor的文件夹复制到WEBRoot

  4、使用FCK的标签,将FCKeditor.tld的标签放置到WEB-INF

     同时修改标签中的内容,要在src的路径下找到该路径:<tag>

          

 <name>editor</name>
           <tagclass>cn.itcast.fredck.FCKeditor.tags.FCKeditorTag</tagclass>
          <bodycontent>JSP</bodycontent>
           <attribute>
           <name>id</name>
          <required>true</required>
            </attribute>

  5、在web.xml中添加:路径要正确

 

  <!--liu add FCK文本编辑器start-->
 <servlet>
 <servlet-name>Connector</servlet-name>
  <servlet-class>cn.itcast.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>cn.itcast.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>
 <!-- end -->
 
 <!-- liu add FCK文本编辑器 start -->
 <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>
   <!-- end -->

6、修改actingIndex.jsp,将站点运行情况和设备运行情况改成FCK文本编辑器

   (1)添加FCK的标签库

<%@ taglib uri="/WEB-INF/FCKeditor.tld" prefix="FCK"%>

   (2)添加:

      

 <FCK:editorid="stationRun" basePath="${pageContext.request.contextPath }/fckeditor/"height="300"
 
               toolbarSet="Basic"
 
              imageBrowserURL="${pageContext.request.contextPath}/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
  
              linkBrowserURL="${pageContext.request.contextPath}/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector">
         
          </FCK:editor>
       <FCK:editorid="devRun" basePath="${pageContext.request.contextPath }/fckeditor/"height="300"
 
               toolbarSet="Basic"
 
              imageBrowserURL="${pageContext.request.contextPath}/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
  
              linkBrowserURL="${pageContext.request.contextPath}/fckeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector">
         
          </FCK:editor> 
上传图片时弹出Error on file upload.Error number:203如附件 error.jpg的错误 
    原因:fck的servlet被struts2转发了 
    解决:在web.xml中修改filter-mapping 将
       
  <filter>
             <filter-name>struts2</filter-name>
             <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class>
         </filter>
         <filter-mapping>
             <filter-name>struts2</filter-name>
             <url-pattern>/*</url-pattern
         </filter-mapping> 
             修改成 
         <filter>
             <filter-name>struts2</filter-name>
             <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class>
         </filter>
         <filter-mapping>
             <filter-name>struts2</filter-name>
             <url-pattern>*.do</url-pattern>
             <url-pattern>*.jsp</url-pattern>
         </filter-mapping> 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值