我正在使用JSF 2.1。我试图在<h:inputTextarea>
上使用TinyEditor。这里是我的代码,为什么<h:outputScript>不起作用<h:form>
<!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编辑器不会被初始化。
这是如何造成的,我该如何解决?
这个解释非常有用,谢谢!但它不工作! – KalaK
如果你已经理解了解释,那么你会在更详细的技术细节中阐述“它的不工作”。但你没有。所以不可能指出你的错误。 – BalusC
对不起! 我没有ü说什么一样, 我已经做了以下的变化, 的样品常见问题小时:inputTextarea> \t ID:“形式:输入” 所以根据代码,输入文本值之后,吸气剂Ñ设定器应该被称为其在豆。 如果我删除编辑器,它工作正常!但如果我添加编辑器,它不会! 根据你的解释,我觉得输入文本区域获取形式的id:输入,但是当我在TinyEditor脚本id:'form:input'中使用它时,它失败! –
KalaK
的