7
我想实现一些javas cript到我的JSF复合组件,但我有问题与id。我的Java脚本与:复合组件和ID
document.getElementById("myForm:customerId")
不起作用,因为id是错的。我有JSF复合组成:
<composite:implementation>
<div id="element_customer">
<h2 class="element_title">Customer</h2>
<h:form id="myForm">
<h:inputText id="customerId" value="#{cc.attrs.customerId}"/>
</h:form>
</div>
</composite:implementation>
和HTML输出是:
<div id="element_customer">
<h2 class="element_title">Customer</h2>
<form id="j_idt44:myForm" name="j_idt44:myForm" method="post" ... >
<input type="hidden" name="j_idt44:myForm" value="j_idt44:myForm" />
<input id="j_idt44:myForm:customerId" ... name="j_idt44:myForm:customerId" />
</form>
</div>
为什么在HTML输出 “j_idt44” 使用?
谢谢。关于使用CC,我发布了关于正确使用的这个问题,但我仍然不确定:http://stackoverflow.com/questions/10056008/proper-using-of-facelet-templates-composite-components – Ziletka 2012-04-27 20:04:41
看起来,我应该使用Facelet标签而不是复合组件。 – Ziletka 2012-04-27 20:15:49
不客气。是的,我想是这样。 – BalusC 2012-04-27 21:11:19