I am trying to dynamically load a view using <f:ajax render=":component"/>
.
That part works with no problems. Using commandLinks in that view, however, does not.
Container that loads the target view dynamically:
<h:form>
<h:commandLink>
<f:param name="tmp2" value="tmp/newxhtml.xhtml"/>
<f:ajax render=":newXhtml"/>
</h:commandLink>
</h:form>
<h:panelGroup layout="block" id="newXhtml">
<ui:include src="#{param['tmp2']}"/>
</h:panelGroup>
When clicking the commandLink, the tmp2 value is set and the 'newXhtml' is re-rendered through ajax.
This link is on the included .xhtml and is not working:
<h:form>
<h:commandLink>
<f:ajax listener="#{backingBean.sampleMethod}"/>
</h:commandLink>
</h:form>
BackingBean.java:
public class BackingBean{
public void sampleMethod() {
//breakpoint here is never hit
}
}
I got it to work when I'm not using
<f:ajax>
to include the page but rather use normal<h:commandLink>
with the action attribute which will save the include page into a@SessionScope
bean.The including xhtml:
The included .xhtml can stay the same.
And the backing bean for the include page: