I have a beforePhase method that is being called twice. My page contains an <f:view beforePhase="#{addressesContactsCtrl.beforePhase}"> and a modalPanel. I only want the beforePhase called on the intial pageload. I don't want the modalPanel to run my beforePhase method. I'm not sure what the best solution is.
<f:view beforePhase="#{addressesContactsCtrl.beforePhase}" />
<h:form>
 #{labels['l.pages.addressesContacts.addressesContacts.extraStops']}
 <t:panelGroup>
 <a4j:region>
 <a4j:commandButton id="addExtraStops" value="#{labels['l.btn.common.Add']}"></a4j:commandButton>
 <rich:componentControl for="panelExtraStops" attachTo="addExtraStops" operation="show" event="onclick"/>
 </a4j:region>
 </t:panelGroup>
</h:form>
<rich:modalPanel id="panelExtraStops" width="310" autosized="true">
 <f:facet name="header">
 <h:panelGroup>
 <h:outputText value="#{labels['l.pages.addressesContacts.modalExtraStops.modalHeader']}"></h:outputText>
 </h:panelGroup>
 </f:facet>
 <f:facet name="controls">
 <h:panelGroup>
 <h:graphicImage value="/images/close.png" style="cursor:pointer" id="hidelinkExtraStops" />
 <rich:componentControl for="panelExtraStops" attachTo="hidelinkExtraStops" operation="hide" event="onclick" />
 </h:panelGroup>
 </f:facet>
</rich:modalPanel>
public void beforePhase(PhaseEvent event) {
 if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
 log.debug("should only be called once, but is called again when modalPanels opened");
 }
}