0

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

1
  • 1
    If you are using JSF2 why are you writing managed-beans configuration? Isn't it easier to use annotations? @ManagedBean Commented Aug 1, 2011 at 10:00

1 Answer 1

1

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; // ... } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.