Richfaces 4 を使用しており、rich:orderingList で選択したアイテムを取得しようとしています。「削除」ボタンを押すだけでリストから削除できるように、これらが必要です。だから私はこれを持っています:
<rich:orderingList id="categoriesList" listHeight="100px"
listWidth="300px" value="#{selectionBean.availableCategories}"
selection="${selectionBean.selectedCategories}"
valueChangeListener="#{selectionBean.takeSelection}" >
<a4j:ajax event="click" render="categoriesList" execute="@this" />
</rich:orderingList>
@ViewScoped バッキング Bean の関数は、ここhttps://community.jboss.org/message/561295から適応させました。
private List<String> availableCategories;
private List<String> selectedCategories;
...............................
public void takeSelection(AjaxBehaviorEvent event) {
System.out.println("ABE In takeSelection...");
System.out.println(" Trying to find component with offering elements...");
UIComponent component = event.getComponent();
System.out.println(" Found: " + (component == null ? "<null>" : (component.getClass().getName() + " - " + component.getId())));
if(component != null) {
System.out.println( " Component that fired the event: " + component.getClass().getSimpleName() + " - " + component.getId());
UIOrderingList orderingList = (UIOrderingList) component;
System.out.println(" selectedCategories are "+ selectedCategories);
}
System.out.println(type + " Leaving takeSelection");
}
問題は、リストをクリックしてアイテムを選択すると、Ajax リクエストが送信されていることはわかりますが、selectedCategories リストが更新されず、takeSelection メソッドも呼び出されないことです。