Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 同一类型的多个@ManagedProperty_Jsf_Jsf 2 - Fatal编程技术网

Jsf 同一类型的多个@ManagedProperty

Jsf 同一类型的多个@ManagedProperty,jsf,jsf-2,Jsf,Jsf 2,我有一个管理bean,其中我使用另一个管理bean: @ManagedProperty(value="#{tableActions}") private TableActions table1; 那很好 现在我需要使用它的另一个实例: @ManagedProperty(value="#{tableActions}") private TableActions table1; @ManagedProperty(value="#{tableActions}") privat

我有一个管理bean,其中我使用另一个管理bean:

@ManagedProperty(value="#{tableActions}") 
private TableActions table1;    
那很好

现在我需要使用它的另一个实例:

@ManagedProperty(value="#{tableActions}") 
private TableActions table1;    

@ManagedProperty(value="#{tableActions}") 
private TableActions table2;    

但是,现在
table2
table1
相同。如何创建一个单独的实例?

将其设置为
@NoneScoped
bean

您只需要确保通过
{yourParentBean.table1}
而不是通过
{tableActions}
在视图中访问它

另见: