我有一种情况,我必须在以下 JSF 页面中的页面加载时执行命令按钮操作侦听器
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:trh="http://myfaces.apache.org/trinidad/html">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1" partialTriggers="pt1">
<af:resource type="javascript">
function callCustomButton(){
var button =AdfPage.PAGE.findComponentByAbsoluteId("cbCustomFields");
ActionEvent.queue(button,true);
}
</af:resource>
<af:clientListener method="callCustomButton" type="load"/>
<af:form id="f1">
<af:pageTemplate viewId="/ESOPM_Base_Template.jspx" id="pt1">
<f:facet name="main_content">
<af:decorativeBox id="db1" theme="medium">
<f:facet name="top"/>
<f:facet name="center">
<af:panelGroupLayout layout="scroll" id="pgl2">
<trh:tableLayout id="tblUpload" cellPadding="3" cellSpacing="3" halign="center" inlineStyle="font-size:1.2em; font-weight:bold; font-family:helvetica,sans-serif;">
<trh:rowLayout id="rl1">
<trh:cellFormat id="cf1">
<af:panelGroupLayout layout="horizontal" id="pgl3">
<af:commandButton text="Custom Fields"
actionListener="#{EditProperties.generateCustomAttributeFields}"
id="cbCustomFields" partialSubmit="true" visible="true"/>
</af:panelGroupLayout>
</trh:cellFormat>
</trh:rowLayout>
</trh:cellFormat>
</trh:rowLayout>
</trh:tableLayout>
</af:panelGroupLayout>
</f:facet>
</af:decorativeBox>
</f:facet>
</af:pageTemplate>
</af:form>
</af:document>
</f:view>
</jsp:root>
命令按钮是“自定义字段”,我试图通过客户端侦听器在页面中使用的 javascript 调用它。但是当用户加载此页面时,按钮不会被点击,并且其动作监听器操作也不会被执行。请帮忙。