AdfPage.PAGE.findComponentByAbsoluteId 返回 null
我试图在页面渲染过程进行时执行一些 JavaScript。 代码是:
<af:document title="Page1" id="d1">
<af:resource type="javascript" source="/resources/js/jquery-1.3.2.js"/>
<af:form id="f1">
<af:panelStretchLayout id="psl1">
<f:facet name="center">
<af:panelGroupLayout id="pgl1">
<af:panelGroupLayout id="main" styleClass="AFStretchWidth" layout="vertical" clientComponent="true">
<af:clientListener method="onMainClick" type="click"/>
<af:serverListener type="clickOnMain" method="#{bean.someMethod}"/>
</af:panelGroupLayout>
</af:panelGroupLayout>
</f:facet>
</af:panelStretchLayout>
<af:resource type="javascript">
var main = AdfPage.PAGE.findComponentByAbsoluteId('main');
alert(main);
if(main != null) {
ActionEvent.queue(main, true);
}
</af:resource>
<af:resource type="javascript">
onMainClick = function (event) {
AdfCustomEvent.queue(event.getSource(), "clickOnMain", {}, true);
}
</af:resource>
</af:form>
</af:document>
但是alert()显示“null”,最终下一个ActionEvent.queue没有执行。
谁能告诉我如何解决这个问题?
I am trying to execute some javascript when the page rendering process is going.
The code is:
<af:document title="Page1" id="d1">
<af:resource type="javascript" source="/resources/js/jquery-1.3.2.js"/>
<af:form id="f1">
<af:panelStretchLayout id="psl1">
<f:facet name="center">
<af:panelGroupLayout id="pgl1">
<af:panelGroupLayout id="main" styleClass="AFStretchWidth" layout="vertical" clientComponent="true">
<af:clientListener method="onMainClick" type="click"/>
<af:serverListener type="clickOnMain" method="#{bean.someMethod}"/>
</af:panelGroupLayout>
</af:panelGroupLayout>
</f:facet>
</af:panelStretchLayout>
<af:resource type="javascript">
var main = AdfPage.PAGE.findComponentByAbsoluteId('main');
alert(main);
if(main != null) {
ActionEvent.queue(main, true);
}
</af:resource>
<af:resource type="javascript">
onMainClick = function (event) {
AdfCustomEvent.queue(event.getSource(), "clickOnMain", {}, true);
}
</af:resource>
</af:form>
</af:document>
But the alert() is showing "null" and eventually the next ActionEvent.queue is not executing.
Can anyone tell me how can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您找到了解决方案。
https://forums.oracle.com/forums/thread.jspa?threadID=2319943
Looks like you found your solution.
https://forums.oracle.com/forums/thread.jspa?threadID=2319943