Reputation: 321
Before I start: I'm running JSF 2.0 MyFaces on Tomcat 6 and I've used some primefaces in this project already.
I've got a page with three filtered dropdowns that set a bunch of parameters in my backing bean. These parameters are then used to include a page under the dropdowns. I'm using ui:include to include this page but I'm pretty sure that ui:include only executes once per lifecycle. That means that the page shows up once and does not change when the dropdowns change.
Here is an example of my view
<h:form>
<!-- dropdowns to build the route to the included page -->
<h:selectOneMenu>
<f:selectItems ... />
<f:ajax
event="change"
render=":formInclude"
execute=":formInclude"
listener="#{control.handledd1Change}"/>
</h:selectOneMenu>
<h:selectOneMenu>
<f:selectItems ... />
<f:ajax
event="change"
render=":formInclude"
execute=":formInclude"
listener="#{control.handledd2Change}"/>
</h:selectOneMenu>
<h:selectOneMenu>
<f:selectItems ... />
<f:ajax
event="change"
render=":formInclude"
execute=":formInclude"
listener="#{control.handledd3Change}"/>
</h:selectOneMenu>
</h:form>
<h:panelGrid id="formInclude">
<ui:include src="#{control.formName}.xhtml"/>
</h:panelGrid>
So, I was wondering what the most correct way of dynamically including a page in JSF is. Am I correct about the ui:include only executing once? Is there anything else out there that I could use to dynamically include a page?
Upvotes: 1
Views: 8378
Reputation: 321
As it turns out I was able to get ui:insert to execute after each drop down change. All I had to do was execute and re-render it using ajax. This was the page that I used to help find my way:
How to include another XHTML in XHTML using JSF 2.0 Facelets?
Upvotes: 1