Dave wrote:
In a PhaseListener, first get all the clientId(s) with queued messages, then
try to find the components. But ViewRoot.findComponent(clientId) return null.
public void beforePhase(PhaseEvent event) {
FacesContext context = event.getFacesContext();
UIViewRoot root = context.getViewRoot();
Iterator<String> itr = context.getClientIdsWithMessages();
while (itr.hasNext()) {
String clientId = itr.next();
UIComponent component = root.findComponent(clientId);
// ERROR: component is null
....
}
}
Thanks for ideas.
I would guess you need to check what phase you are in before proceeding.
It doesn't make much sense to call findComponnet before the Restore View
phase, for example.
L.