【问题标题】:Any way to remove children of a specific component in jsf?有什么方法可以删除 jsf 中特定组件的子级?
【发布时间】:2012-05-17 10:33:20
【问题描述】:

我正在使用 jsf 1.2 和 icefaces 1.8

我有一个弹出窗口,我正在那里构建一个向导。

使用 c:forEach 我在第 2 步中为用户显示一些输入。问题是当返回第 1 步时,选择另一个选项并在第 2 步中显示另一组输入输入组件的 ID 被保留...

有什么方法可以删除主 div 的子元素?

我的结构是这样的:

    <ice:panelGroup binding="#{addServiceResourcesBean.wrapperDiv}">

      <c:forEach
                    var="index"
                    begin="0"
                    end="#{addServiceResourcesBean.attribsListSize}"
                    step="1"
                    varStatus="status">

          //inputs rendered
     </c:forEach>
    </ice:panelGroup>

我只是希望从 wrapperDiv 中删除所有子项将强制 jsf 循环使用其他 id 从头开始​​重新创建它们...

【问题讨论】:

    标签: jsf icefaces


    【解决方案1】:

    这对我有用,只需拨打getChildren,然后拨打clear

    <h:form id="form1">
      <h:panelGroup id="panel1">
          .... forEach ...
    
      </h:panelGroup>
    </h:form>
    
    String clientId = "form1:panel1";
    UIComponent comp = FacesContext.getCurrentInstance().getViewRoot().findComponent(clientId);
    // here there is the call
    comp.getChildren().clear();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-13
      相关资源
      最近更新 更多