我想知道是否可以從問題nesting-jsf-expression-strings適應ExtendedBeanELResolver以及處理這種嵌套EL表達式:試圖巢JSF表達串
#{controllerBean.getBean('userProfileBean', component).street}*
由此controllerBean.getBean返回bean userProfileBean。我會與ExtenedBeanELResolver以下異常得到:
SCHWERWIEGEND: javax.el.PropertyNotFoundException: /WEB-INF/templates/modification/userProfile.xhtml @35,196 value="#{controllerBean.getBean('userProfileBean', component).street}": Property 'getBean' not found on type com.something.ControllerBean
如果我插入它的工作原理附加括號,但看起來更加難看比現在:
#{(controllerBean.getBean('userProfileBean', component)).street}*
是否有可能沒有額外的做括號?
Update 1之後,CycDemo的回答是:
奇怪的問題。 如果我把
<h:inputText value="#{beanOne.getBean('data').title}" />
內表單頁面呈現,但直到我提交表單。之後,將顯示相同的錯誤。
WARNUNG: /WEB-INF/templates/home.xhtml @61,66 value="#{beanOne.getBean('data').title}": Property 'getBean' not found on type com.something.BeanOne
如果我將其更改爲
<p:inputText value="#{beanOne.getBean('data').title}" />
頁甚至不會呈現在開始。 我認爲問題在於JSF在提交表單時嘗試調用setter,但無法正確評估它。
任何想法?
更新2
Appearently JSF試圖調用getGetBean(),因爲它是在尋找財產 BeanOne(我曾在日食一個斷點),這是錯誤的:
@ManagedBean
@ViewScoped
public class BeanOne {
private Object bean = new String("something");
public Object getBean(String name) {
FacesContext context = FacesContext.getCurrentInstance();
return context.getApplication().evaluateExpressionGet(context,
"#{" + name + "}",
Object.class);
}
public Object getGetBean() {
return bean; // <-- will be called by JSF
}
public void setGetBean(Object bean) {
this.bean = bean;
}
}
再次獲得該錯誤下面的配置?提交你的事業; – CycDemo