Reputation: 4615
what is the general way when requesting new pages with given parameters, i.e. calling CDI bean operations and bind the outcome to the page components?
I am using this 'pattern', but is this the right way?
<ui:define name="content">
<h:form id="dataForm">
#{userForm.init(param.id, param.mode)}
<!-- User edit Dialog -->
<p:panel>
...
</:panel>
</h:form>
</ui:define>
The problem is that when using the 'rendered' attribute, this depends on the bean (non-blocking) process outcome but the page might be rendered faster. Thus, I should be able to call an update process on the page UI components after processing.
Upvotes: 0
Views: 179
Reputation: 2089
If you are using JSF 2.2 the way to go is:
<f:metadata>
<f:viewAction action="#{backingBean.action}"/>
</f:metadata>
If you are < JSF2.2 but you happen to be using Seam you could use something like this as a pre-render view event, it does not have to be in a template, you can drop it in your ui:composition
XHTML
xmlns:s="http://jboss.org/seam/faces"
<f:metadata>
<s:viewAction action="#{backingBean.action}" />
</f:metadata>
here is something to read Seam3, if not you can always use the classic way:
<f:metadata>
<f:viewParam name="id" value="#{backingBean.entryId}"/>
<f:event type="preRenderView" listener="#{backingBean.loadEntry}"/>
</f:metadata>
Upvotes: 1