lt;/init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url- pattern>/fckeditor/editor/filemanager/browser/default/connectors/jsp/connecto r</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>/fckeditor/editor/filemanager/upload/simpleuploader</url- pattern>
</servlet-mapping>
请注意,这两个servlet的url-pattern我都在原来 代码的前面加上了/fckeditor。
SpringSide开发实战(七):在项目中整合FCKeditor(6)
时间:2011-05-07 blogjava 海边沫沫
然后,我们就可以抛开JavaScript,而在服务器端使用标签来创建Web编辑器了。先在 EditPosts.jsp中引入标签库: <%@ taglib uri="http://fckeditor.net/tags- fckeditor" prefix="FCK" %>
再在原来放textarea的地方,放如下代码:<FCK:editor id="EditorDefault" basePath="/xkland/fckeditor/"
imageBrowserURL="/xkland/fckeditor/editor/filemanager/browser/default/browser.ht ml?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="/xkland/fckeditor/editor/filemanager/browser/default/browser.htm l?Connector=connectors/jsp/connector"
flashBrowserURL="/xkland/fckeditor/editor/filemanager/browser/default/browser.ht ml?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="/xkland/fckeditor/editor/filemanager/upload/simpleuploader? Type=Image"
linkUploadURL="/xkland/fckeditor/editor/filemanager/upload/simpleuploader? Type=File"
flashUploadURL="/xkland/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>
这里有一点一定要注意,那就是这里的属性都要避免使用相对路径。
刷新页面,又见编辑器,此时,可以顺利的上传文件了。整合编辑器的任务到此完成。 下一步,就是怎样对编辑器进行更多的控制了。
五、对编辑器进行更多控制
1、自定义工具条:打开fckeditor目录下的fckconfig.js文件,添加如下代码:
FCKConfig.ToolbarSets["Usable"] = [
[''Source'',''Preview''],
[''Undo'',''Redo'',''-'',''SelectAll'',''Cut'',''Copy'',''Paste'',''-'',''RemoveFormat'',''-'',''Find '',''Replace''],
[''Link'',''Unlink'',''Anchor''],
[''FitWindow'',''-'',''About''],
''/'',
[''Bold'',''Italic'',''Underline'',''StrikeThrough'',''-'',''Subscript'',''Superscript''],
[''OrderedList'',''UnorderedList'',''-'',''Outdent'',''Indent''],
[''JustifyLeft'',''JustifyCenter'',''JustifyRight'',''JustifyFull''],
[''Image'',''Flash'',''Table'',''Rule'',''Smiley''],
''/'',
[''Style'',''FontFormat'',''FontName'',''FontSize''],
[''TextColor'',''BGColor'']
] ;
2、 |