Events 是否可以对要在阶段上调用的backingbean方法进行注释?

Events 是否可以对要在阶段上调用的backingbean方法进行注释?,events,jsf,binding,jsf-2,phaselistener,Events,Jsf,Binding,Jsf 2,Phaselistener,我需要在绑定组件后调用支持bean中的初始化器方法@在组件绑定之前调用PostConstruct。对于在组件绑定后导致方法调用的方法,是否有JSF注释 目前,可以使用像或这样的东西,这需要在页面和bean端编写代码。有没有只有bean端的解决方案?在标准JSF API中没有这样的解决方案 最接近您所能得到的是在getter中延迟加载 public UIComponent getSomeComponent() { if (!initialized(someComponent)) {

我需要在绑定组件后调用支持bean中的初始化器方法@在组件绑定之前调用PostConstruct。对于在组件绑定后导致方法调用的方法,是否有JSF注释


目前,可以使用像
这样的东西,这需要在页面和bean端编写代码。有没有只有bean端的解决方案?

在标准JSF API中没有这样的解决方案

最接近您所能得到的是在getter中延迟加载

public UIComponent getSomeComponent() {
    if (!initialized(someComponent)) {
        initialize(someComponent);
    }
    return someComponent;
}
或者在setter中懒洋洋地执行

public void setSomeComponent(UIComponent someComponent) {
    if (!initialized(someComponent)) {
        initialize(someComponent);
    }
    this.someComponent = someComponent;
}