Struts2使用ckeditor

首先下载struts2使用的插件:struts2-jquery-richtext-plugin.jar (点击下载)

在使用的页面添加标签:

<%@ taglib prefix="sjr" uri="/struts-jquery-richtext-tags"%> 

下面是编辑器的默认值:

<sjr:ckeditor  
                                       
id="richtextEditor"  
                                       
name="echo"  
                                       
rows="10"  
                                       
cols="80"  
                                       
width="800" 
                                       
value="Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos." 
                               
/>

下面是个简短的例子:

页面上的东西:

<%@ taglib prefix="sjr" uri="/struts-jquery-richtext-tags"%> 
                <sjr:ckeditor  
                        label="Your Text" 
                        href="%{remoteurl}"  
                        id="richtextCustomeEditor"  
                        name="echo"  
                        rows="10"  
                        cols="80"  
                        loadingText="Loading content of textarea ..." 
                        width="600" 
                        toolbar="MyToolbar" 
                        skin="v2" 
                        editorLocal="fr" 
                        customConfig="%{contextPath}/js/ckeditor.config.js"

注意红色的js文件

自己放代码如下:

CKEDITOR.editorConfig = function( config ) 
{ 
  config
.toolbar = 'MyToolbar'; 
 
  config
.toolbar_MyToolbar = 
 
[ 
     
['NewPage','Preview'], 
     
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Scayt'], 
     
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], 
     
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'], 
     
'/', 
     
['Styles','Format'], 
     
['Bold','Italic','Strike'], 
     
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], 
     
['Link','Unlink','Anchor'] 
 
]; 
 
};


 这样基本可以用了

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值