要素を含む JSF ページがあり<h:selectManyMenu>
ます。value 属性は、サブクラスで type として定義された汎用オブジェクトを指しますArrayList<String>
。Java のドキュメントによると、この具象型のUISelectMany
として変換から値を返す必要があります。Collection
しかし、それはString[]
配列として返されています。私は何が欠けていますか?
<h:selectManyMenu value="#{parameter.value}">
<f:selectItems value="#{parameter.valueList}"/>
</h:selectManyMenu>
public class Parameter<ArrayList<String>> extends ParentClass
{
private LinkedHashMap<Object, String> valueList;
public List<SelectItem> getValueList()
{
ArrayList<SelectItem> list = new ArrayList<SelectItem>();
for (Iterator<Object> i = this.valueList.keySet().iterator(); i.hasNext();)
{
Object value = i.next();
list.add(new SelectItem(value, this.valueList.get(value)));
}
return list;
}
}
public abstract class ParentClass<T>
{
private T value;
public T getValue() { return this.value; }
public void setValue(T t) { this.value = t; }
}