[struts]集成kindeditor出现的问题

1、

错误现象:使用textarea取不到值,仅为“”。

KindEditor.ready(function(K) {
            var editor1 = K.create('textarea[name="paperContent"]', {
                cssPath : 'kindeditor/plugins/code/prettify.css',
                uploadJson : 'admin/resource/common_uploadFile.action',
                allowFileManager : false,
                afterCreate : function() {
                    var self = this;
                    K.ctrl(document, 13, function() {
                        self.sync();
                        document.forms['form'].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function() {
                        self.sync();
                        document.forms['form'].submit();
                    });
                },
                afterBlur:function(){
                    this.sync();
                }
            });
            prettyPrint();
        });

错误原因:

未知。

解决办法:

如果你的按钮是input[type=submit]的话你不需要考虑这个问题,但如果你使用js提交那么在提交之前要调用一下editor.sync()

函数用以赋值给你的textarea。即需要加上

afterBlur:function(){
this.sync();
}

 

KindEditor.ready(function(K) {
            var editor1 = K.create('textarea[name="paperContent"]', {
                cssPath : 'kindeditor/plugins/code/prettify.css',
                uploadJson : 'admin/resource/common_uploadFile.action',
                allowFileManager : false,
                afterCreate : function() {
                    var self = this;
                    K.ctrl(document, 13, function() {
                        self.sync();
                        document.forms['form'].submit();
                    });
                    K.ctrl(self.edit.doc, 13, function() {
                        self.sync();
                        document.forms['form'].submit();
                    });
                },
                afterBlur:function(){
                    this.sync();
                }
            });
            prettyPrint();
        });

2、

错误现象:编辑内容前台显示不正确,直接将html标签显示出来。

如:

正确显示应该为:

 

错误原因:

使用<s:property value="paper.content"/>显示数据,返回的是字符串,带双引号如:“xxxxx”。

解决办法:

直接用jstl标签${paper.content}。

posted @ 2013-04-11 20:45  wanpp590  阅读(313)  评论(0编辑  收藏  举报