我正在使用 JSF 2.1。我正在尝试在<h:inputTextarea>
. 这是我的代码,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<h:outputStylesheet library="css" name="editor_style.css" />
<h:outputStylesheet library="css" name="css/main.css" />
<h:outputStylesheet library="css" name="css/dropdown.css" />
<h:outputScript name="js/tinyeditor.js"></h:outputScript>
</h:head>
<h:body>
<div class="content">
<ui:include src="/template/layout/commonLayout.xhtml" />
<ui:include src="/template/layout/menu.xhtml" />
<h:form>
<div class="quick_links">
<div class="q_title">
</div>
<div class="q_window">
<div class="q_top"></div>
<div class="q_main">
<h:inputTextarea value="#{EditorBean.value}" id="input"
style="width:100%; height:300px;">Sample FAQ</h:inputTextarea>
<h:outputScript>
new TINY.editor.edit('editor',{
id:'input',
width:945,
height:175,
cssclass:'te',
controlclass:'tecontrol',
rowclass:'teheader',
dividerclass:'tedivider',
controls:['bold','italic','underline','strikethrough','|','subscript','superscript','|',
'orderedlist','unorderedlist','|','outdent','indent','|','leftalign',
'centeralign','rightalign','blockjustify','|','unformat','|','undo','redo','n',
'font','size','style','|','hr','link','unlink'],
footer:true,
fonts:['Verdana','Arial','Georgia','Trebuchet MS'],
xhtml:true,
cssfile:'style.css',
bodyid:'editor',
footerclass:'tefooter',
toggle:{text:'Source',activetext:'HTML',cssclass:'toggle'},
resize:{cssclass:'resize'}
});
</h:outputScript>
</div>
<div class="q_bottom"></div>
</div>
<h:commandButton value="Savebutton" action="#{EditorBean.test}"></h:commandButton>
</div>
<div class="push"></div>
</h:form>
</div>
</h:body>
</html>
如果我删除<h:form>
标签,那么只会显示编辑器,但<h:commandButton>
它不起作用。如果我保留<h:form>
标签,那么<h:commandButton>
工作,但 TinyEditor 编辑器没有被初始化。
这是如何引起的,我该如何解决?