Reputation: 545
I'am using JSF2.0, I want to pass to a bean a property has the type ArrayList ,can I do that? if ues what will be the property-class!
private ArrayList<String> selectedEnvironment;
<managed-bean>
<managed-bean-name>Mybean</managed-bean-name>
<managed-bean-class>package.Mybean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>selectedEnvironment</property-name>
<property-class>?</property-class>
<value>#{FMTools.selectedEnvironment}</value>
</managed-property>
</managed-bean>
Thank you
Upvotes: 0
Views: 1004
Reputation: 1108632
You don't need it if the <value>
is dynamic already (you're using EL in it). JSF will take care of it. Just omit the <property-class>
. You only need it if the <value>
is static and you want to set it as something else than String
(which it defaults to).
Unrelated to the concrete problem, since JSF 2.0 you don't need the stinkin' faces-config anymore to declare managed beans and managed properties. You can use annotations.
@ManagedBean(name="MyBean")
@RequestScoped
public class MyBean {
@ManagedProperty(value="#{FMTools.selectedEnvironment}")
private List<String> selectedEnvironment;
// ...
}
Upvotes: 1