【问题标题】:Managed property - Unable to set property托管属性 - 无法设置属性
【发布时间】:2013-08-08 08:04:29
【问题描述】:

我正在尝试使用 ManagedProperty:

从这里

@ManagedBean(name = "SelectionBean")
@SessionScoped
public class TableSelectionBean implements Serializable {
    private String selectionMode = "single";
    private Collection<Object> selection;
    private List<MonitoringData> monitoringData;
    private List<MonitoringData> selectionMonitoringData;

到这里:

@ManagedBean(name="ActionBean")
@SessionScoped
public class MonitoringActionBean implements Serializable {
    private ThreadPoolExecutor executor;
    @ManagedProperty(value="{SelectionBean.selectionMonitoringData}")
    private List<MonitoringData> selectedMonitoring;

我收到以下错误消息:

com.sun.faces.mgbean.ManagedBeanCreationException:无法为托管 bean ActionBean 设置属性 selectedMonitoring ... 原因:java.lang.IllegalArgumentException:无法将类 java.lang.String 类型的 {SelectionBean.selectionMonitoringData} 转换为接口 java.util.List

知道为什么它不起作用吗?

【问题讨论】:

  • TableSelectionBean 是否包含selectionMonitoringData 的吸气剂?
  • 是的,也包含getter和setter

标签: jsf jsf-2 el


【解决方案1】:

您似乎忘记了主题标签:

@ManagedProperty(value="{SelectionBean.selectionMonitoringData}")

应该是:

@ManagedProperty(value="#{SelectionBean.selectionMonitoringData}")

【讨论】:

    猜你喜欢
    • 2012-07-31
    • 2019-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-07
    • 2011-02-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多