[英]JSF 2.0 with Expression is a method error
我在jsf頁面中有這一行
<h:dataTable value="#{customer.getCustomerList()}"
我的豆子里有
public List<Customer> getCustomerList(){
return customerBo.findAllCustomer();
}
我正在使用帶有servlet 2.5的Eclipse Helios的JSF 2.0,當我驗證我得到的時候
Expression must be a value expression but is a method expression
我該如何解決這個問題?
我有一個類似的問題,盡管我做得對,就像PermGenError發布的那樣。 我有這個:
<h:commandButton action="#{bean.registry}"></h:commandButton>
我得到錯誤: 表達式必須是方法表達式,但它是一個值表達式
在我的Bean中,有:
class Bean{
Registry registry = new Registry();
public Registry getRegistry() {
return registry;
}
}
此消息的原因是Eclipse無法以JSF方式識別這實際上是方法調用,並將此消息稱為錯誤。 這可以通過這種方式關閉:
窗口/首選項/ Web / JavaServer Faces工具/驗證/類型分配問題/預期的方法表達式
更改為警告或忽略
我希望這會對某人有所幫助!
視圖:
<h:dataTable value="#{customer.customerList}"
h:dataTable
的value
屬性需要值表達式,而不是方法表達式。 您必須在#{customer}
托管bean中創建名為customerList
的屬性。
@ManagedBean(name="customer")
public class Customer implements Serializable {
private List<Customer> custormerList= new ArrayList<Customer>();
public void setCustomerList(List<Customer> cust){
this.customerList = cust;
}
public List<Customer> getCustomerList(){
return customerBo.findAllCustomer();
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.