I have this line in my jsf page
<h:dataTable value="#{customer.getCustomerList()}"
and in my bean I have
public List<Customer> getCustomerList(){
return customerBo.findAllCustomer();
}
I am using JSF 2.0 with Eclipse Helios with servlet 2.5 and when I validate I am getting
Expression must be a value expression but is a method expression
How can I resolve this issue?
I have a similar problem, despite the fact i was doing right, like PermGenError posted. I had this:
<h:commandButton action="#{bean.registry}"></h:commandButton>
And i got error: Expression must be a method expression but is a value expression
In my Bean, there was:
class Bean{
Registry registry = new Registry();
public Registry getRegistry() {
return registry;
}
}
Reason of this message is that Eclipse doesn't recognize that this is actually method calling, in JSF manner, and give this message like an error. This can be turned off on this way:
Window/ Preferences/ Web/ JavaServer Faces Tools/ Validation/ Type Assignment Problems/ Method expression expected
change to Warning or Ignore
I hope this will help someone!
View:
<h:dataTable value="#{customer.customerList}"
The value
attribute of your h:dataTable
expects a value expression, not a method expression. You have to create a property called customerList
in your #{customer}
managed bean.
@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();
}
}
Refer to the h:dataTable tag documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With