JSF f:event preRenderView is triggered by f:ajax calls and partial renders, something else?

Posted by Andrew on Stack Overflow See other posts from Stack Overflow or by Andrew
Published on 2010-05-13T22:52:43Z Indexed on 2010/05/14 2:44 UTC
Read the original article Hit count: 468

Filed under:
|

So we have an f:event:

   <f:metadata>
    <f:event type="preRenderView" listener="#{dashboardBacking.loadProjectListFromDB}"/>
   </f:metadata>

Which is triggered as desired on initial page load (render).

However this preRenderView event is also triggered by an ajax partial page render, which re-renders an h:panelgroup with the id projectListing, as below.

<h:commandButton action="#{mrBean.addProject}" value="Create Project"
                                     title="Start a new project">
   <f:ajax render="projectListing" />
</h:commandButton>

I only want the dashboardBacking.loadProjectListFromDB to be called for the initial page render, but not when there is an ajax partial render. Is there a more appropriate event or method I could be using?

© Stack Overflow or respective owner

Related posts about jsf2

Related posts about AJAX