1

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?

1 Answer 1

1

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?

Sign up to request clarification or add additional context in comments.

1 Comment

Could you provide @Dave example how use ui:insert to change content based on drop down changes? Thx.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.