1
votes

As suggested by BalusC as an answer to this question, I wanto to create a managed property like this:

@ManagedProperty("#{paramValues.freetext}")
private String[] ftValues;

public String[] getFtValues(){ 
    return ftValues;
}

public void setFtValues(String[] values){
    ftValues = values;
}

In my project every managed bean declaration and settings has done in the faces-config.xml file. Putting the annotation in the code as suggested, doesn't bring me any result. ftValues is always null, even if I have one or more <input name="freetext"> Is it possible that the annotation is not take into consideration because the main configuration technique use the XML file?

How can I put the ManagedProperty declaration into the faces-config.xml? I tried adding

<managed-property>
    <property-name>ftValues</property-name>
    <property-class>java.lang.String[]</property-class>
    <value>#{paramValues.freetext}</value>
</managed-property>

in the appropriate managed bean section, but it crashes with this error

Bean or property class java.lang.String[] for managed bean myBean cannot be found.

1

1 Answers

2
votes

Indeed, the annotations are ignored whenever you declare the bean in faces-config.xml. If removing the bean from faces-config.xml is really not an option for some unclear reason, then you need to remove the <property-class> to fix the problem. JSF can perfectly figure it by itself.