erik.c
erik.c

Reputation: 1362

Managed property - Unable to set property

I'm trying to use ManagedProperty:

From here

@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;

to here:

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

and i got the following error message:

com.sun.faces.mgbean.ManagedBeanCreationException: Unable to set property selectedMonitoring for managed bean ActionBean ... Caused by: java.lang.IllegalArgumentException: Cannot convert {SelectionBean.selectionMonitoringData} of type class java.lang.String to interface java.util.List

Any idea why it is not working?

Upvotes: 0

Views: 4175

Answers (1)

Menno
Menno

Reputation: 12651

It seems you're forgetting the hashtag:

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

Should be:

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

Upvotes: 1

Related Questions