<form action="sampleposteddata.jsp" method="get" target="_blank">
<FCK:editor id="EditorDefault" basePath="/FCKeditor/" height="400"
imageBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=UserFiles/Image"
linkUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
flashUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash">
This is some <strong>sample text</strong>. You are using <a href="http://www.fredck.com/fckeditor/">FCKeditor</a>.
</FCK:editor>
<br>
<input type="submit" value="Submit">
</form>
表单示例:
basePath="/FCKeditor/"仅仅只是设立FCKeditor的主程序目录
imageUploadURL="/FCKeditor/editor/filemanager/upload/simpleuploader?Type=UserFiles/Image"
中UserFiles/Image为文件上传的目录,其路径相对于根目录设立的。那么其全路径为http://localhost:8084/FCKeditor/UserFiles/Image
basePath="/FCKeditor/"是设立应用程序根目录,参考该段话:{注意:你可以将FCKEDITOR放置到任何文件夹,默认情况下,将其放入到FCKEDITOR文件夹是最为简单的方法.如果你放入的文件夹使用别的名称,请修改配置文件夹中编辑器BasePath参数,如示:Fckeditor.BasePath="/Components/fckeditor/";}
可以在应用的任何路径下使用FCKeditor编辑器,且无须设置其他的路径,因为所有的路径都是相对根路径的。
★安装FCKeditor时,需要注意的几步操作:
假设应用程序目录/newDading,编辑器所在目录/newDading/FCKeditor
1。在netbeans中先建立newDading应用程序后,载入FCKeditor主程序:将FCKeditor主目录下的fckconfig.js、fckeditor.js、fckstyles.xml、fcktemplates.xml、以及editor目录一同拷入到/newDading/FCKeditor下。
2。载入FCKeditor的java支持:将FCKeditor的java包下的src目录拷入netbeans工程目录(newDading目录)替换src目录(也就是说将FCKeditor的java包下的src目录中的com目录和FCKeditor.tld拷入到netbeans工程目录下的src目录中);将FCKeditor的java包下的web目录拷入netbeans工程目录替换web目录(也就是说将FCKeditor的java包下的web/WEB-INF/lib目录中两个包拷到工程相应目录和将FCKeditor的java包下的web/WEB-INF/web.xml中servlet申明和映射加入到工程的web.xml中。
3。修改路径配置:
在2中提到的web.xml中的servlet映射:
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>/editor/filemanager/upload/simpleuploader</url-pattern>
</servlet-mapping>在/editor前加入/FCKeditor,因为我们是在根目录的FCKeditor目录下(如果在1中将FCKeditor的主程序拷在根目录则无须修改)。修改如下:
<url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
<url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>
另外的一个更改就是,如果要开启FCKeditor的上传功能的话,就要将web.xml中的SimpleUploader的servlet申明中的enable参数改为true。如下:
<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>true</param-value>
</init-param>
<init-param>
<param-name>enabled</param-name>
<param-value>true</param-value>
4。建立示例页面时的问题:首先载入头部标记库申明<%@ taglib uri="http://fckeditor.net/tags-fckeditor" prefix="FCK" %>;调用编辑器标签,如下:
<form action="sampleposteddata.jsp" method="get" target="_blank">
<FCK:editor id="EditorDefault" basePath="/newDading/FCKeditor/"
imageBrowserURL="/newDading/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="/newDading/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="/newDading/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="/newDading/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Userfiles/Image"
linkUploadURL="/newDading/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Userfiles/File"
flashUploadURL="/newDading/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Userfiles/Flash">
This is some <strong>sample text</strong>. You are using <a href="http://www.fredck.com/fckeditor/">FCKeditor</a>.
</FCK:editor>
<br>
<input type="submit" value="Submit">
</form>注意设置其中的文件浏览和上传的路径,路径前都需用相对根目录的全路径,即都要加入/newDading,而这里并不是设置文件浏览和上传的路径,它只是一种处理路径,真正的路径设置是在web.xml中设置。