1

selectOfferMpans我在其他 bean 中注入bean

@ManagedProperty(value="#{selectOfferMpans}")
private SelectOfferMpans selectOfferMpans;    

public void setSelectOfferMpans(SelectOfferMpans selectOfferMpans) {
    this.selectOfferMpans = selectOfferMpans;
}

如果我询问第二个 bean 的selectOfferMpans.selectedSitesin值@PostConstruct,调试器会说它为空。

此属性已在 1.xhtml 的此操作中更新

<p:commandButton id="pCBFind" styleClass="centerAbs" type="submit" icon="ui-  icon-search" value="#{text['selectOfferMpans.find']}" actionListener="#{selectOfferMpans.findCustomer}" update="CustomerData,CustomerSites" oncomplete="expandAll();"/>

然后,当用户单击此按钮时,应用程序将从 1.xhtml 导航到 2.xhtml

p:commandButton id="pCBCreateOffer" type="submit" icon="ui-icon-check" value="#{text['selectOfferMpans.newOffer']}"
                    action="#{selectOfferMpans.goToOffers}"/>

来自 bean1 的代码

public String goToOffers(){
        try{

            JSFHelper.addParamToRequest(SofycParamNames.CUSTOMER_ID,   customerfound.getCustomerId());
        JSFHelper.addParamToRequest(SofycParamNames.OPTION, this.getMenuOrigin());
        return SofycNavigation.VIEW_CREATE_OFFERS_PAGE;

    } catch (Throwable t) {
        log.error("goToOffers:", t);
        JSFHelper.addErrorMessage(ID_OFFER_SELECT_MPANS_FORM, "Error navigating to offers page");            
        return null;
    }
}                  

我错过了什么?

4

0 回答 0