myfaces-api-1.1.5.jar を使用しています。(残念ながら、これ以外は使えません!)
バッキング Bean testBB から実行時に (つまり、動的に) 以下を作成したいと考えています。
<t:selectOneMenu
value="#{testBB.someVO}"
converter="someVOConverter"
valueChangeListener="#{testBB.vcl}"
onchange="submit();" style="width:170px">
<f:selectItems value="#{testBB.selectItemList}"/>
</t:selectOneMenu>
これまでの私のコードは次のとおりです。
private UIComponent createComponent(
String id, String componentType, UIComponent parent) {
if (componentType == null) {
throw new NullPointerException("argument 'componentType' is null");
}
if (parent == null) {
throw new NullPointerException("argument 'parent' is null");
}
UIComponent newComponent = this.
getApplication().createComponent(componentType);
newComponent.setId(id);
newComponent.setParent(parent);
parent.getChildren().add(newComponent);
logger.debug("new Component created.. ");
return newComponent;
}
private HtmlSelectOneMenu createSelectOneMenu(
String id, UIComponent parent, String expr) {
HtmlSelectOneMenu selectOneMenu =
(HtmlSelectOneMenu) this.createComponent(id,
HtmlSelectOneMenu.COMPONENT_TYPE, parent);
UISelectItems items = (UISelectItems)this.
createComponent("selectItem", UISelectItems.COMPONENT_TYPE, selectOneMenu);
ValueBinding valueBinding = this.getApplication().createValueBinding(expr);
items.setValueBinding(id, valueBinding);
return selectOneMenu;
}
そして、私はそれを次のように呼び出します:
this.createSelectOneMenu("someId", "somePanelGrid", "#{testBB.selectItemList}");
Google を試し、StackOverflow を検索しましたが、MyFaces と JSF 1.1 に固有のものは見つかりませんでした。
すべてのヘルプは大歓迎です。