I am calling a page from another with a prerender view event in an f:metadata element.
If I navigate to page using <h:link> it works and calls the listener method.
However if I navigate to the page using an outcome from the action method of a managed bean belonging to the calling page, the listener designated in the prerenderview doesn’t get called (as it does if called by a link). It does navigate to the second page, just no listener call.
I would really prefer to call from the action method because I use it to do some work and place a variable in the session map for the called page to use. I’m not sure how to achieve the same thing using a link. The object can be rather large… kb not Mb but still not something I want to put in the request.
I’ve tried making the managed bean of the calling page request scoped and view scoped.
Is it not possible to get a prerenderview to fire if it is called from a managed bean outcome? As I said, I got it to work from a link.
<body>
<ui:define name="metadata">
<f:view>
<f:metadata>
<f:event type="preRenderView" listener="#{businessBean.init}" />
</f:metadata>
</f:view>
</ui:define>
<ui:composition template="#{navigationprops.soulard_2col_uprefs_template}">
ui:composition tag trim everything outside it, so facelets compiler doesn’t have the chance to read the code. Instead, you should use ui:decorate, but remember f:metadata tag only works on the top level page, not inside the template client. For example:
See This example for details.