Jsf 2.0 f: ajax render ID not found

When the "Save" button in the pop-up window (pp1) clicked on the list of projects, it will be updated. But when you click the refresh button in the project list, the rendering identifier: form1: pp1 does not appear when an error occurs. If do render = "@all", this works, but it is not good. (error: <f:ajax> contains unknown id ': form1: pp1')

 <h:form id="form1" prependid=false> <h:panelGroup id="projects"> <ui:repeat var="action" value="#{dadadada}" varStatus="status"> <h:commandButton value="Save"> //gives id not found error <f:ajax event="click" execute="@form" render=":form1:pp1" listener="#{fsfsfsfsfs}" /> </h:commandButton> </ui:repeat> </h:panelGroup> // project panel group //popup <h:panelGroup id="pp1"> <div id="popup2" class="popup_block"> //save button in the popup <div class="popupBody_save2"> <h:commandButton image="resources/images/saveBtn.gif" value="Save"> <f:ajax event="click" execute="@form" render="projects" listener="#{dfsfssfs}" /> </h:commandButton> </div> </div> </h:panelGroup> </h:form> 
+4
source share
2 answers

:form1:pp1 will not work, since you have prependId="false" in the form. pp1 will not work, as it searches for a component in the same scope as <ui:repeat> , which itself is a component of UINamingContainer .

Open the JSF page in webbrowser, rightclick and View Source to get the generated HTML. Find the HTML element that is generated by <h:panelGroup id="pp1"> . It should look something like this.

 <span id="foo:bar:pp1"> 

You need to use exactly this identifier with the prefix : in the render attribute.

 <f:ajax render=":foo:bar:pp1"> 

If there is an auto- j_id0 identification part, such as j_id0 , then you need to specify the parent component in question with a fixed ID.

+6
source

If you use prependId=false , then your panelGroup identifier is pp1 instead of form1:pp1 . (Suppose you have a typo in your prependID attribute, not prependid.)

0
source

All Articles