托管财产 - 无法设置财产

时间:2013-08-08 08:04:29

标签: jsf jsf-2 el

我正在尝试使用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

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

1 个答案:

答案 0 :(得分:1)

好像你忘记了标签:

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

应该是:

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