FCKeditor的使用

????? 今天下载了FCKeditor2.4,在网上搜索了很多使用方法,按照一步一步操作。但是最后还是没有配置成功。

????? 参照fckeditor-java-demo-2.4.1.war,部署了应用后,直接可以把这个应用中的直接拿过来用,在web.xml中添加:?


??Connector
??
???net.fckeditor.connector.ConnectorServlet
??

??1
?

?
??Connector
??
??/fckeditor/editor/filemanager/connectors/*
?

这个是demo里的配置。和网上的2.3版本变化很大。

添加包,commons-fileupload-1.2.1.jar,commons-io-1.3.2.jar,fckeditor-java-core-2.4.1.jar,slf4j-simple-1.5.2.jar

copy?? "fckeditor"文件夹,原始下载的也可以,网上说了一大堆,删除什么什么,也不是必要的。

最后还必须在classes目录下新建fckeditor.properties文件。添加一行:

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

在jsp 文件中只需要加入

?????? <%@ page language="java" import="net.fckeditor.*"%>

??????? <% FCKeditor fckEditor = new FCKeditor(request, "EditorDefault");
??????? fckEditor.setValue("");
??????? fckEditor.setHeight("400");//具体方法参考FCKeditor类源文件
??????? out.println(fckEditor);%>

部署好了,可以正确显示,但是在上传文件时又遇到了问题。上传时显示

Security?error.?You?probably?don't?have?enough?permissions?to?upload.?Please?check?your?server

原来是因为struts2拦截器的缘故。修改web.xml的filter-mapping:

?? ??

????????struts2 ?? ????????*.action ?? ??????? ???? ?? ????????struts2 ?? ????????*.jsp ?? ??????

ok了,上传文件也正常。

?

你可能感兴趣的:(fckeditor,Servlet,JSP,.net,Web)