I have a generic JSF page and abstract class that is implemented by many other pages and used to do its main processing in a @PostConstruct method. Now that I'm using URL parameters for some of the pages, I want to move all of the pages' processing into a viewAction action method instead so that it can use the URL parameters in their processing.
Of course, I can't use f:metadata/f:viewAction in my template because that's not allowed by JSF:
When using <ui:composition> templating, where should I declare the <f:metadata>?
Is there a way to handle post-viewAction processing by all of my pages in a generic manner? Right now I have it working with an f:event tag:
Template page:
<ui:insert name="metadata"/>
<h:head>
<f:event type="preRenderComponent" listener="#{controller.postProcessParams}" />
</h:head>
Client page:
<ui:define name="metadata">
<f:metadata>
<f:param name="id" value="#{manageProjects.id}"/>
<f:viewAction action="#{manageProjects.processParams}"/>
</f:metadata>
</ui:define>
<ui:param name="controller" value="#{manageProjects}"/>
Is this proper though?