I have a page where I want to include part of the page (the footer in this case) depending on the values given from the view parameter.
I have my ViewScoped support for bean initialization on preRenderView
<f:metadata> <f:viewParam name="racecode" value="#{displayResults.racecode}" /> <f:event type="preRenderView" listener="#{displayResults.init}" /> </f:metadata>
This queries the database to get the footer name to be included. Then it is used as follows:
<h:panelGroup id="customFooter" display="block"> <ui:include src="#{displayResults.customFooter}" /> </h:panelGroup>
This always gives me the missing page. But if I enter the page name manually, it will work. Same thing if I replaced ui:include with h:outputText .
I understand that it has something to do with JSF steps and that, at runtime ui:include value has not yet been set. (reading and a better understanding of the phases is something on my TODO list).
The question remains. How can I get something like this. Ask the bean to use viewParam, query the database and use this value in ui:include ?
source share