i have a composite component that contains a form with ajax. what i can’t figure out is why it only works for the @form/@all render parameter.
<cc:interface>
<cc:attribute name="radioItem"/>
<cc:attribute name="radioItems" />
<cc:attribute name="compImage" />
<cc:attribute name="compSpecification"/>
</cc:interface>
<!-- IMPLEMENTATION -->
<cc:implementation>
<h:form>
<div id="options">
<h:selectOneRadio value="#{cc.attrs.radioItem}" >
<f:selectItems value="#{cc.attrs.radioItems}" />
<f:ajax render=":details" />
</h:selectOneRadio>
</div>
<div id="details">
<h:graphicImage value="#{cc.attrs.compImage}"/>
<h:outputText value="#{cc.attrs.compSpecification}"/>
</div>
</h:form>
</cc:implementation>
What am i missing?
This problem is two-fold:
You’re specifying an absolute client ID
:detailswhile the element to be re-rendered is inside the sameUINamingContainerparent, so JSF won’t be able to locate it in the component tree. You need to specify a relative client IDdetails.You have specified the ID on a plain vanilla HTML element instead of a real JSF component, so JSF won’t be able to locate it in the component tree. You need to use a real JSF component. You need to replace
<div>by<h:panelGroup layout="block">.So, fix it both:
That it works with
@formand@allis just because JSF can locate the element to be re-rendered relative to the component on which the ajax action is been invoked, namely the parentUIFormandUIViewRootcomponent respectively.