0

I have a JSF 2 .xhtml page which looks like this:

<h:body>
  <f:event type="preRenderView" listener="#{view.init}" />
  <customComponents:mytable />
</h:body>

And the composite implementation

<composite:implementation>
    <h:form id="tableForm">
      <ui:repeat value="#{view.actions}" var="action">
      <h:outputText value="#{action.start}">
        <f:convertDateTime timeZone="#{view.timeZone}" />
      </h:outputText>
    </h:form>
</composite>

Now when I load the view the composite's #{view.timeZone} is called BEFORE listener={view.init}

I don't get this. I want the init message called before the getter is called. Can you tell me where the mistake is?

matthias
  • 1,938
  • 23
  • 51

1 Answers1

0

preRenderView has to be in f:metadata tag. For example:

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

FYI, this post can help you too When to use f:viewAction / preRenderView versus PostConstruct?

Rapster
  • 484
  • 1
  • 5
  • 23