0

这是我的代码<h:selectOneMenu>
在支持 bean execdirectorRC="XXXvalue" 中分配值后,我试图从支持 bean 更新它的值。在这里,executivedirectorslist确实有一个列表值。

这是表格中的代码

<h:form id="ipdpform">
  <h:selectOneMenu id="exedirectors" value="#{Bean.execdirectorRC}">
    <f:selectItems value="#{Bean.executivedirectorslist}"
       var="s" itemLabel="#{s.label}" itemValue="#{s.value}" />
    <p:ajax listener="#{Bean.getDirectReporters}"
       update="rpt2 :growl :error" execute="@this"
       partialSubmit="true" />
    <f:param name="rpt1" value="rpt1" />
  </h:selectOneMenu>
</h:form >

这是我试图从支持 bean 更新值的代码

RequestContext context = RequestContext.getCurrentInstance();
                execdirectorRC = "XXX,Name";
                context.update("ipdpform:exedirectors");


我的问题是值“XXX,Name”没有得到更新,<h:selectOneMenu>.并且值已经在Bean.executivedirectorslist.How 可以从支持 bean 更新它?

4

1 回答 1

0

您可以使用如下静态实用程序函数。

public static void addWillBeUpdatedComponent(final String componentId) {
        FacesContext.getCurrentInstance().getPartialViewContext()
                .getRenderIds().add(componentId);
    }

public static void removeWillBeUpdatedComponent(final String componentId) {
        FacesContext.getCurrentInstance().getPartialViewContext()
                .getRenderIds().remove(componentId);
}

componentId必须form:componentId不是这种格式:form:componentId

于 2014-03-25T10:10:19.830 回答