fck的工程实例,完整配置,在myeclipse8.1调试通过
一:配置web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>Connector</servlet-name>
<servlet-class>
net.fckeditor.connector.ConnectorServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>
/fckeditor/editor/filemanager/connectors/*
</url-pattern>
</servlet-mapping>
</web-app>
二:在网页中使用时:
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK"%>
<FCK:editor instanceName="test" width="600" height="300" toolbarSet=""/>
通过以上两步你就可以在你的jsp网页中使用了
三:下面来介绍fck的简单的几种样式:
样式配置是通过:/fckeditor/fckconfig.js中的
FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/silver/' ;
这一句来配置的
1:像office2003的配置为:
FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/office2003/' ;
显示如图:
2:default的样式为
FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;
显示图像为:
3:sliver的配置为:
FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/sliver/' ;
图像为:
四:编辑器上的控件也是可以自己定制的:
在fckconfig中一般默认的是这个:
FCKConfig.ToolbarSets["Default"] = [
['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;
控件个数也是像上面图像上一样.
自己定制就要另外在fckconfig中定制:
如:
FCKConfig.ToolbarSets["Blog"] = [
['Bold','Image','Smiley','Style','UnorderedList','TextColor','Link','Unlink','-','About']
] ;
在页面引用时就这样:
<FCK:editor instanceName="test" width="600" height="300" toolbarSet="Blog"/>