Chinaunix首页 | 论坛 | 博客
  • 博客访问: 554288
  • 博文数量: 855
  • 博客积分: 40000
  • 博客等级: 大将
  • 技术积分: 5005
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-16 19:08
文章分类

全部博文(855)

文章存档

2011年(1)

2008年(854)

我的朋友

分类:

2008-10-16 19:25:15

在 2.3 和FCKeditor.包 FCKeditor-2.3.jar

配置web.xml 支持FCKEditor的图片文件上传和浏览


< servlet >
    
< servlet-name > Connector servlet-name >
    
< servlet-class > com.fredck.FCKeditor.connector.ConnectorServlet servlet-class >
    
< init-param >
          
< param-name > baseDir param-name >
          
< param-value > /uploadfiles/ param-value >
    
init-param >
    
< init-param >
          
< param-name > debug param-name >
          
< param-value > false param-value >
     
init-param >
     
< load-on-startup > 2 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 > /uploadfiles/ 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 />
        
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|htm|html 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 />
        
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 />
        
init-param >
        
< load-on-startup > 1 load-on-startup >
    
servlet >
     
    
< servlet-mapping >
        
< servlet-name > Connector servlet-name >
        
< url-pattern > /components/fck/editor/filemanager/browser/default/connectors/jsp/connector url-pattern >
    
servlet-mapping >
   
    
< servlet-mapping >
        
< servlet-name > SimpleUploader servlet-name >
        
< url-pattern > /components/fck/editor/filemanager/upload/simpleuploader url-pattern >
    
servlet-mapping >

 

    1.3 加入FCKeditor-2.3.jar和commons-fileupload.jar

    1.4 但是fckeditor的文件实在太多了,让人没来由一阵心痛,删除以下目录及文件:

    1./_testcases,  /_samples,
    2./editor/_source,  /editor/skins/office2003, /editor/skins/silver,
/editor/filemanager/upload, /editor/filemanager/browser/default/connector
    3./editor/lang 仅保留en.js,zh_cn.js
    4.在/的php,py等后缀名的文件
    5.删除plugin目录和dialog目录的spellcheck

    1.5 将干净的fck目录复制到项目中

    1.6 修改配置文件 fckconfig.js

    FCKConfig.DefaultLanguage  = 'zh-cn' ;

    删除spell check 相关的两处地方

    修改如下 url, 使用 fckeditor servelt 来做文件上传与目录浏览:

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

如果还有时间可以修理一下FCKConfig.ToolbarSets["Default"],只留下需要的功能。

JSP 中的使用方法

<% @ page language = " java "   import = " com.fredck.FCKeditor.* "   %>
<%
FCKeditor oFCKeditor ;
oFCKeditor 
=   new  FCKeditor( request,  " content "  ) ;
oFCKeditor.setBasePath( 
" /cms/admin/components/fck/ "  ) ;    ---- FCK所在路径
oFCKeditor.setValue(“value” );                          
---- 文本框内的值    
out.println( oFCKeditor.create() ) ;
%>


【责编:Peng】

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

--------------------next---------------------

阅读(251) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~