Jsf “我有脸例外”;abc";离动物园不远

Jsf “我有脸例外”;abc";离动物园不远,jsf,jsf-2,primefaces,clientid,ajax-update,Jsf,Jsf 2,Primefaces,Clientid,Ajax Update,我有这样一个场景,在下拉菜单中选择一个值,我的面板id=abc应该显示出来。但我得到的是faces异常“abc”无法从zoo中避免。 对代码改进有什么建议吗。。。。 先谢谢你 <p:selectOneMenu id="zoo" value="#{cc.attrs.bean.test}" style="width:150px" label="#{hello.description}" converter="testConverter">

我有这样一个场景,在下拉菜单中选择一个值,我的面板id=abc应该显示出来。但我得到的是faces异常“abc”无法从zoo中避免。 对代码改进有什么建议吗。。。。 先谢谢你

    <p:selectOneMenu id="zoo" value="#{cc.attrs.bean.test}" style="width:150px"  label="#{hello.description}" 
            converter="testConverter">
                 <p:ajax event="change" listener="#{cc.attrs.bean.onTest}" update="abc"/>
                 <f:selectItems value="#{cc.attrs.bean.sooo}" var="soh" itemLabel="#{soh.ex1}" itemValue="#{soh}"/>
             </p:selectOneMenu>

             <p:accordionPanel style="width:580px;" id="xyz">
    <p:tab title="Test for tab"id="hfg">
    <p:outputPanel style="width:525px;display:block" id="abc" > 
<ui:repeat id="foo" value="#{cc.attrs.bean.animal}" var="yyy">
<h:panelGroup rendered="#{!yyy.aaa}"  id="ppp">
<h:outputText value="#{yyy.flower />
<p:selectOneMenu id="wooo" value="#{yyy.house}" label="#{yyy.car}" converter="yyyConverter">
<f:selectItem itemLabel="" itemValue="" />  
<f:selectItems value="#{yyy.example}" var="sss" itemLabel="#{sss.p1}:#{sss.dp2}" itemValue="#{sss}"/>
</p:selectOneMenu>
</h:panelGroup>
</ui:repeat>


问题是,您正在尝试更新一个元素(p:outputPanel),该元素嵌入到另一个元素(p:tab)中,并且p:tab也嵌入到具有id的p:accordionPanel中。您必须在更新属性中指定所有父id,如下所示:

  <p:selectOneMenu id="zoo" value="#{cc.attrs.bean.test}" style="width:150px"  label="#{hello.description}" 
    converter="testConverter">
         <p:ajax event="change" listener="#{cc.attrs.bean.onTest}" update="xyz:hfg:abc"/>
         <f:selectItems value="#{cc.attrs.bean.sooo}" var="soh" itemLabel="#{soh.ex1}" itemValue="#{soh}"/>
  </p:selectOneMenu>

  <p:accordionPanel style="width:580px;" id="xyz">
  <p:tab title="Test for tab" id="hfg">
    `enter code here`
    <p:outputPanel style="width:525px;display:block" id="abc" >    
    </p:outputPanel>
  </p:tab>

`在这里输入代码`


您还应该在标题和p:tab的id之间留出一个空格,id=hfg

感谢ans。它工作得很好,但是我正在更新的id在选择下拉列表时没有得到刷新…我看不到id=“abc”的组件中嵌入了任何值。我想您必须在那里输入代码。我已经编辑了代码,还调试了控制器类,以确认所有的值都在那里。@BalusC您能帮忙吗?我已经编辑了代码。现在我遇到了一个问题,页面没有刷新并从db加载所有数据