本文介绍了使用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);
}
}
解决方案
无法评估非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
@ManagedBeanpublic 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编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!