我在其他bean中注入bean selectOfferMpans
@ManagedProperty(value="#{selectOfferMpans}")
private SelectOfferMpans selectOfferMpans;
public void setSelectOfferMpans(SelectOfferMpans selectOfferMpans) {
this.selectOfferMpans = selectOfferMpans;
}
如果我在第二个bean的selectOfferMpans.selectedSites
中询问@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;
}
}
我错过了什么?