我正在尝试实现The earliest moment to visitTree() on fully built Component Tree?中提到的动态用户访问级别。但是,在解析时我没有看到完整的DOM树。在解析时我只能看到模板页面的子元素。我错过了什么?
代码段:
面-config.xml中
<system-event-listener>
<system-event-listener-class>com.xyz.listner.FieldDisableListener</system-event-listener-class>
<system-event-class>javax.faces.event.PostAddToViewEvent</system-event-class>
<source-class>javax.faces.component.UIViewRoot</source-class>
</system-event-listener>
JSF页面
<ui:composition template="/WEB-INF/templates/samplePage.xhtml">
<ui:param name="focusElement" value="frmWelcome:newProfileLink" />
<ui:define name="pageContents">
<h:form id="pendingsearchForm" styleClass="content-body">
<h:commandLink action="#{searchBean.release}"
id="searchcmdbtn" <<-- updated
value="Release"
immediate="true"
rendered="#{searchBean.resultFound}" >
</h:commandLink>
听众代码
@Override
public void processEvent(SystemEvent event) throws AbortProcessingException {
UIViewRoot root = (UIViewRoot) event.getSource();
loadUserAccessConfig();
processViewTree(root);
}
@Override
public boolean isListenerForSource(Object source) {
if (source instanceof UIViewRoot)
return true;
return false;
}
答案 0 :(得分:0)
我在JSF树解析逻辑中做了以下更改,以使我的代码工作:
SAR