preRenderView和Ajax

I have a preRenderView attached to a component A. There is another component B which has ajax. The ajax would render a hidden component which has some text fields in it. The problem is the ajax is not rendering the inputText field

<h:form....>
<ui:composition...>
<f:event type="preRenderView" listener="#{bean.action}">
...........
<ui:composition/>

<ui:composition...>
<h:selectOneRadio....>
<f:ajax render="inputTextId"../>
<h:selectOneRadio/>
<ui:fragment rendered="#{condition}">
<h:inputText id="inputTextId" ...../>
<ui:fragment/>
<ui:composition/>
<h:form/>

The re-rendering takes place at the client side with help of JavaScript after receiving the Ajax response. It requires the generated HTML output of the to-be-updated component to be already in the client side. In your case, it's however never there in the generated HTML output. You need to swap the rendered and id attributes.

<h:selectOneRadio ...>
    <f:ajax render="inputTextWrapperId" />
</h:selectOneRadio>
<h:panelGroup id="inputTextWrapperId" >
    <h:inputText id="inputTextId" rendered="#{condition}" />
</h:panelGroup>

This issue is unrelated to the pre render view event. You would have exactly the same problem when you removed it.

See also: