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