fck默认的图片上传路径是在fckeditor-java-core.jar的net.fckeditor.handles包下的default.properties中定义的,内如如下:
fck是在net.fckeditor.handlers包中的PropertiesLoader类中声明了一个static的properties来一次性读入所有的配置的
这是个静态的属性,而且提供了修改的权限
#
base directory for the user files relative to the context root
connector . userFilesPath = / userfiles
connector . userFilesPath = / userfiles
fck是在net.fckeditor.handlers包中的PropertiesLoader类中声明了一个static的properties来一次性读入所有的配置的
这是个静态的属性,而且提供了修改的权限
/**
* Setter for a property. If the property already exists, the value will be
* overridden.<br />
* <em>Hint</em>: This method is intended as an alternative way to set
* properties programmatically instead of using the
* <code>fckeditor.properties</code>. It should never used inside
* FCKeditor.Java!!!
*
* @param key
* The property key.
* @param value
* The property value.
* @see Properties#setProperty(String, String)
*/
public static void setProperty( final String key, final String value) {
properties.setProperty(key, value);
}
所以只需要在fck加载之前修改他既可,比如可以修改fck的例子如下:
* Setter for a property. If the property already exists, the value will be
* overridden.<br />
* <em>Hint</em>: This method is intended as an alternative way to set
* properties programmatically instead of using the
* <code>fckeditor.properties</code>. It should never used inside
* FCKeditor.Java!!!
*
* @param key
* The property key.
* @param value
* The property value.
* @see Properties#setProperty(String, String)
*/
public static void setProperty( final String key, final String value) {
properties.setProperty(key, value);
}
String userCode
=
"
xxx
"
;
//
此处可以获取登录用户code
等动态代码
PropertiesLoader.setProperty( " connector.userFilesPath " , " /aaaa " + userCode);
fckEditor.setValue( " This is some <strong>sample text</strong>. You are using <a href=/ " http: // www.fckeditor.net/">FCKeditor</a>.");
out.println(fckEditor);
这样会生成aaaxxx文件夹
PropertiesLoader.setProperty( " connector.userFilesPath " , " /aaaa " + userCode);
fckEditor.setValue( " This is some <strong>sample text</strong>. You are using <a href=/ " http: // www.fckeditor.net/">FCKeditor</a>.");
out.println(fckEditor);