fckeditor2.6.6 java上传图片到绝对路径的配置

2014-11-24 03:22:05 · 作者: · 浏览: 0

改绝对路径不需要修改源码。增加一些简单的配置就可以了。可以回显。另外要设置tomcat的server.xml,加一个硬盘映射。

fckeditor 2.6.6

我的是maven工程。

1:拷贝fckeditor文件夹到webapp/js下面

2:修改fckeditor/fckeditor.js里面的FCKeditor.BasePath = '/js/fckeditor/' ;

3:web.xml里面加入

  
   
   
    Connector
   
   
   
     net.fckeditor.connector.ConnectorServlet 
   
   
   
    1
   
  
  
  
  
   
   
    Connector
   
   
   
     /js/fckeditor/editor/filemanager/connectors/* 
   
  
  

4:src/main/resources下面新建fckeditor.properties,写入

connector.userActionImpl=net.fckeditor.requestcycle.impl.EnabledUserAction

#connector.impl = net.fckeditor.connector.impl.LocalConnector
#connector.userPathBuilderImpl = com.hb.FilePathBuilder


#################################################################
#connector.impl=com.hb.ContextConnector
#connector.userPathBuilderImpl = com.hb.ContextPathBuilder


connector.userFilesAbsolutePath = E://image
connector.userFilesPath = http://localhost:9080/image
  
connector.userPathBuilderImpl = net.fckeditor.requestcycle.impl.ServerRootPathBuilder
connector.impl = net.fckeditor.connector.impl.LocalConnector

5:加入依赖。pom里面加入

  
			
   
    javax.servlet
   
			
   
    servlet-api
   
			
   
    2.5
   
			
   
    provided
   
		
  
		
  
			
   
    javax.servlet.
    jsp
   
			
   
    jsp-api
   
			
   
    2.1
   
			
   
    provided
   
		
  
		
  
			
   
    javax.servlet
   
			
   
    jstl
   
			
   
    1.2
   
			
   
    provided
   
		
  
		
		
  
			
   
    net.fckeditor
   
			
   
    java-core
   
			
   
    2.6
   
		
  
		
  
			
   
    org.devlib.schmidt
   
			
   
    imageinfo
   
			
   
    1.9
   
		
  
		
  
			
   
    org.slf4j
   
			
   
    slf4j-simple
   
			
   
    1.5.8
   
		
  

6:server.xml配置context,加入

7:jsp文件

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK"%>



  
    FckEditor测试



  

FckEditor测试


www.sunchis.com

如果设置了fckeditor的基本路径,比如这里房子js下面,要修改的地方有jsp里面的basePath、web.xml、fckeditor.xml

如果直接放在webapp下面,这些文件都不需要修改


You are not authorized to browse/list files and/or folders

我开始没有使用pom配置jar包,后来fckeditor.properties里面类名后面多了空格,报出这个错误。实际上是因为fck默认不提供上传图片的权限,必须声明connector.userActionImpl=net.fckeditor.requestcycle.impl.EnabledUserAction

而web.xml配置fck路径错误的话,会报出The server didn't reply with a proper XML data. Please check your configuration.