jsfjsf-2primefacesclientidajax-update

i am getting faces exception "abc" cannot be refrenced from zoo


I have scenario where selecting a value in drop down my panel id=abc should display.But i am getting faces exception "abc" cannot be refrenced from zoo. Any suggestion for code improvemnt.... Thanks in advance...

    <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>


Solution

  • The problem is that you are trying to update an element (p:outputPanel) which is embedded in another element (p:tab) with an id and of which the p:tab is embedded too in an p:accordionPanel with an id. You have to specify all the parents ids in the update attribute like below:

      <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>
    

    You should also put a space between the title and the id of your p:tab with id=hfg.