The earliest moment to visitTree() on fully built Component Tree?

前端 未结 1 2007
陌清茗
陌清茗 2021-01-24 02:18

Good morning, JSF experts!

Let me fugure out the problem I\'m trying to solve. The application has many forms. And elements in forms can be marked to require authorizati

1条回答
  •  失恋的感觉
    2021-01-24 02:59

    That's the PostAddToViewEvent of the UIViewRoot itself. You can hook into it using a SystemEventListener implementation like below:

    public class YourSystemEventListener implements SystemEventListener {
    
        @Override
        public boolean isListenerForSource(Object source) {
            return (source instanceof UIViewRoot);
        }
    
        @Override
        public void processEvent(SystemEvent event) throws AbortProcessingException {
            UIViewRoot view = (UIViewRoot) event.getSource();
            // ...
        }
    
    }
    

    Which is registered in of faces-config.xml like below:

    
        com.example.YourSystemEventListener
        javax.faces.event.PostAddToViewEvent
        javax.faces.component.UIViewRoot
    
    

    0 讨论(0)
提交回复
热议问题