使用CKEditor而不是PrimeFaces编辑器 [英] Using CKEditor instead of PrimeFaces Editor

查看:151
本文介绍了使用CKEditor而不是PrimeFaces编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的JSF应用程序中使用CKEditor。



index.xhtml



 < form action =method =post> 
< p>
我的编辑:< br />
< textarea cols =90rows =20id =editor1name =editor1value =#{EditorBean.value}>< / textarea&
< script type =text / javascript>
CKEDITOR.replace('editor1',
{
uiColor:'#85B5D9'
});
< / script>
< input type =buttonvalue =Clearname =clearonclick =clear1()/>
< / p>
< / form>



BackingBean



@ManagedBean
public class EditorBean {

  private String value; 

public String getValue(){
return value;
}

public void setValue(String value){
this.value = value;
System.out.println(Content:+ value);
}

}



<当我试图打印的值,它不是打印。帮我解决这个问题。 PrimeFaces编辑器不支持插入表功能。所以,我想使用CKE。

解决方案

无法评估非JSF组件。



将此页添加到您的页面:

 < h:inputHidden value =# EditorBean.value}id =editorValue/> 

onblur c> textarea 使用

分配值到隐藏元素

  document.getElementById(editorValue).value = this.value; 


I am trying to use CKEditor in my JSF application. How to get the content of CKEditor into backing bean..?

index.xhtml

<form action=""  method="post">
            <p>
            My Editor:<br />
                <textarea cols="90" rows="20"  id="editor1" name="editor1" value="#{EditorBean.value}"></textarea>
                <script type="text/javascript">
                        CKEDITOR.replace( 'editor1',
                        {
                            uiColor: '#85B5D9'
                        });
                </script>
                <input type="button" value="Clear" name="clear" onclick="clear1()"/>
            </p>
        </form>

BackingBean

@ManagedBean public class EditorBean {

private String value;

public String getValue() {
    return value;
}

public void setValue(String value) {
    this.value = value;
    System.out.println("Content: "+value);
}

}

When I tried to print the value, It is not printing. Help me on this issue. PrimeFaces Editor is not supporting "Insert Table" function. So, I want to use CKE.

解决方案

As el wont be able to evaluate non-JSF component.

Add this to your page :

<h:inputHidden value="#{EditorBean.value}" id="editorValue"/>

and onblur of editor textarea assign the value to the hidden element using

document.getElementById(editorValue).value = this.value;

这篇关于使用CKEditor而不是PrimeFaces编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆