于是明白,是这个文件访问不到,看来还是路径有问题,于是修改路径,前面加上:request.getContextPath() 就可以访问到了。
<%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "EditorDefault" ) ;
oFCKeditor.setBasePath( request.getContextPath() + "/fckeditor/" ) ;
oFCKeditor.setValue( "This is some <strong> sample text </strong> . You are using <a href=\"http://www.fredck.com/fckeditor/\"> FCKeditor </a> ." );
out.println( oFCKeditor.create() ) ;
%>
页面显示出来了,接下来要开始编写JAVA程序,实现保存和显示功能了: 根据 FCKeditor-2.3.zip JAVA 集成包中的,_samples 目录下的例子,实现了功能。 修改 ACTION: String contentString = (String)request.getParameter("EditorDefault"); //"EditorDefault"是控件默认的提交参数名
System.out.println("***************");
System.out.println("contentString="+contentString);
bc.setContent(contentString); 这样就得到了控件中提交的值,是一个字符串,例如: <p> <span style="font-family: Comic Sans MS"> we </span> <span style="background-color: lime"> are </span> <span style="font-size: medium"> friends </span> </p> 就可以保存到数据库里去了。 为了在页面控件中显示出来,修改 ACTION: request.setAttribute("contentString", bc.getContent()); 修改 JSP: <%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "EditorDefault" ) ;
oFCKeditor.setBasePath( request.getContextPath() + "/fckeditor/" ) ;
String contentString = (String) request.getAttribute("contentString");
if(contentString != null)
oFCKeditor.setValue( contentString );
out.println( oFCKeditor.create() ) ;
%>
如果需要修改默认的参数名:"EditorDefault" 则只需要修改 JSP 里的代码,将: oFCKeditor = new FCKeditor( request, "EditorDefault" ) ; 修改为: oFCKeditor = new FCKeditor( request, "contentString" ) ;
接着按照“ 在jsp环境中配置使用FCKEditor” 文章中的方法进行瘦身。 最后开始配置工具栏,工具栏的配置主要是对 fckeditor 目录下的 fckconfig.js 进行修改。 可以在网上搜索‘fckconfig.js’或者 ‘FCK 工具栏’,找到一篇文章:FCK编辑器精简工具栏
fckconfig.js 中关于工具栏的设置原始为: 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'],
['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.ToolbarSets["Default"] = [
['Source'],['PasteText','PasteWord','-'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','ShowBlocks'],
'/',
['Bold','Italic','Underline','StrikeThrough'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink'],['TextColor','BGColor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['FontFormat','FontName','FontSize'], ] ;
最后我去除了一些功能,精简为: FCKConfig.ToolbarSets["Default"] = [
['PasteText','PasteWord','-'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['Link','Unlink'],['TextColor','BGColor'],
['Table','Rule','SpecialChar','PageBreak'],
'/',
['Bold','Italic','Underline','StrikeThrough'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['FontFormat','FontName','FontSize'],
] ;
注意里面可以任意变换顺序, '/', 代表分行, 一个 [] 里的内容为一个集中区域。
好了,希望这篇文章对需要的人有帮助.
<%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "EditorDefault" ) ;
oFCKeditor.setBasePath( request.getContextPath() + "/fckeditor/" ) ;
oFCKeditor.setValue( "This is some <strong> sample text </strong> . You are using <a href=\"http://www.fredck.com/fckeditor/\"> FCKeditor </a> ." );
out.println( oFCKeditor.create() ) ;
%>
页面显示出来了,接下来要开始编写JAVA程序,实现保存和显示功能了: 根据 FCKeditor-2.3.zip JAVA 集成包中的,_samples 目录下的例子,实现了功能。 修改 ACTION: String contentString = (String)request.getParameter("EditorDefault"); //"EditorDefault"是控件默认的提交参数名
System.out.println("***************");
System.out.println("contentString="+contentString);
bc.setContent(contentString); 这样就得到了控件中提交的值,是一个字符串,例如: <p> <span style="font-family: Comic Sans MS"> we </span> <span style="background-color: lime"> are </span> <span style="font-size: medium"> friends </span> </p> 就可以保存到数据库里去了。 为了在页面控件中显示出来,修改 ACTION: request.setAttribute("contentString", bc.getContent()); 修改 JSP: <%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "EditorDefault" ) ;
oFCKeditor.setBasePath( request.getContextPath() + "/fckeditor/" ) ;
String contentString = (String) request.getAttribute("contentString");
if(contentString != null)
oFCKeditor.setValue( contentString );
out.println( oFCKeditor.create() ) ;
%>
如果需要修改默认的参数名:"EditorDefault" 则只需要修改 JSP 里的代码,将: oFCKeditor = new FCKeditor( request, "EditorDefault" ) ; 修改为: oFCKeditor = new FCKeditor( request, "contentString" ) ;
接着按照“ 在jsp环境中配置使用FCKEditor” 文章中的方法进行瘦身。 最后开始配置工具栏,工具栏的配置主要是对 fckeditor 目录下的 fckconfig.js 进行修改。 可以在网上搜索‘fckconfig.js’或者 ‘FCK 工具栏’,找到一篇文章:FCK编辑器精简工具栏
fckconfig.js 中关于工具栏的设置原始为: 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'],
['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.ToolbarSets["Default"] = [
['Source'],['PasteText','PasteWord','-'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','ShowBlocks'],
'/',
['Bold','Italic','Underline','StrikeThrough'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink'],['TextColor','BGColor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
'/',
['FontFormat','FontName','FontSize'], ] ;
最后我去除了一些功能,精简为: FCKConfig.ToolbarSets["Default"] = [
['PasteText','PasteWord','-'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['Link','Unlink'],['TextColor','BGColor'],
['Table','Rule','SpecialChar','PageBreak'],
'/',
['Bold','Italic','Underline','StrikeThrough'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['FontFormat','FontName','FontSize'],
] ;
注意里面可以任意变换顺序, '/', 代表分行, 一个 [] 里的内容为一个集中区域。
好了,希望这篇文章对需要的人有帮助.
解决方案 »
- 求简单的select标签筛选表格的简单代码。。。?哭
- 求助,点击图片,使用ajax异步加载对应的视频
- JS脚本引用问题
- javascript方向键有没有支持firefox
- 如何新打开一个固定大小的新页面
- 请问在html中的一个checkbox的onclick事件,怎样在javascript中模拟呢??
- ckeditor 4.3 支持自动检测语言么?
- 请问曾经CSDN介绍过纯用javascript制作的画图组件是什么
- 请问如何让类似 “2/(1-1/3)”这样的表达式得到精确的值?结果应该是3,但javascript中得到的是2.99...5
- 表单提交问题,在线等待!!!
- 在线等待脚本高手。。。。。。。。这个怎么实现?
- 用DOM创建XML文件 在FireFox下没有反映 该如何在FF下做创建XML!! 解决后立刻结帖
另外要设置编辑器的长度,宽度, 也可以通过这个类实现:oFCKeditor.setHeight("300");