gpt4 book ai didi

java - 带有表达式的 JSF 2.0 是一个方法错误

转载 作者:搜寻专家 更新时间:2023-11-01 01:06:35 25 4
gpt4 key购买 nike

我的 jsf 页面中有这一行

<h:dataTable value="#{customer.getCustomerList()}"

在我的 bean 里有

public List<Customer> getCustomerList(){
return customerBo.findAllCustomer();
}

我将 JSF 2.0 与 Eclipse Helios 和 servlet 2.5 一起使用,当我验证时,我得到了

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 方式调用的方法,并像错误一样提供此消息。这可以通过这种方式关闭:

Window/Preferences/Web/JavaServer Faces Tools/Validation/Type Assignment Problems/Method expression expected

更改为警告忽略

我希望这会对某人有所帮助!

关于java - 带有表达式的 JSF 2.0 是一个方法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13539955/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com