title: Oracle-ADF inlineFrame initializing view scoped bean twice
body: <p><em>Oracle ADF 12.1.2, Java 1.7, Oracle WebLogic 12.1.2</em></p>
  
  <p>I am facing strange issue related with <code>af:inlineFrame</code> component. Trying to display/render ADF page inside of <code>af:popup</code> within <code>af:inlineFrame</code> component. The weird thing is when the popup displayed; view scoped bean's <code>@PostConstruct</code> method called twice. That means bean is initialized twice. However it needed to be initialized once since bean is referenced from the page that is going to be displayed inside <code>af:inlineFrame</code>.</p>
  
  <p>Correct flow gotta be:</p>
  
  <ol>
  <li>Click to button <code>openPopup()</code> method called.</li>
  <li><code>openPopup()</code> sets URI then opens popup.</li>
  <li><code>inlineFrame source</code> property set as it's going to display <code>framePage.jspx</code>.</li>
  <li>JSF scans <code>framePage.jspx</code> code finds out there is a reference to <code>FrameBean</code> inside <code>af:outputLabel</code></li>
  <li>Construct <code>FrameBean</code> then call <code>@PostConstruct</code> method.</li>
  <li>Call appropriate getter and render page.</li>
  </ol>
  
  <p>What happens in my case:</p>
  
  <ol>
  <li>Click to button <code>openPopup()</code> method called.</li>
  <li><code>openPopup()</code> sets URI opens popup.</li>
  <li><code>inlineFrame source</code> property set as it's going to display <code>framePage.jspx</code>.</li>
  <li>JSF scans <code>framePage.jspx</code> code finds out there is a reference to <code>FrameBean</code> inside <code>af:outputLabel</code></li>
  <li>Construct <code>FrameBean</code> then call <code>@PostConstruct</code> method.</li>
  <li>Call appropriate getter and render page.</li>
  <li>Construct <code>FrameBean</code> then call <code>@PostConstruct</code> method.</li>
  <li>Call appropriate getter and render page.</li>
  </ol>
  
  <p>Popup located like:</p>
  
  <pre><code>&lt;af:popup id="mainPopup" binding="#{mainBean.mainPopup}"&gt;
      &lt;af:dialog id="mainDialog"&gt;
          &lt;af:inlineFrame source="#{mainBean.URI}"&gt;
          &lt;/af:inlineFrame&gt;
      &lt;/af:dialog&gt;
  &lt;/af:popup&gt;
  </code></pre>
  
  <p>Showing popup via <code>af:button action="#{mainBean.openPopup}"</code>:</p>
  
  <pre><code>public void openPopup() {
      this.setURI("http://localhost:7001/app/framePage.jspx");
      RichPopup.PopupHints hints = new RichPopup.PopupHints();
      this.getMainPopup().show(hints);
  }
  </code></pre>
  
  <p>framePage.jspx:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:af="http://xmlns.oracle.com/adf/faces/rich"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt;
  &lt;jsp:directive.page contentType="text/html;charset=UTF-8" /&gt;
      &lt;f:view&gt;
          &lt;af:document title="Frame Demo" id="demoDocument"&gt;
              &lt;af:form id="demoForm"&gt;
                  &lt;af:outputLabel value="HELLO Common user!"&gt;&lt;/af:outputLabel&gt;
                  &lt;af:outputLabel value="#{frameBean.commonId}"&gt;   &lt;/af:outputLabel&gt;
              &lt;/af:form&gt;
          &lt;/af:document&gt;
      &lt;/f:view&gt;
  &lt;/jsp:root&gt;
  </code></pre>
  
  <p>FrameBean:</p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  public class FrameBean {
      private String commonId;
  
      @PostConstruct
      public void afterInit() {
  
      }
  
      public String getCommonId() {
          return commonId;
      }
  
      public void setCommonId(String commonId) {
          this.commonId = commonId;
      }
  }
  </code></pre>
  
  <p>Making <code>FrameBean</code> <code>@SessionScoped</code> solves this issue since bean is kept with session but I don't want to keep it within session. Also setting <code>source</code> property of <code>af:inlineFrame</code> in jspx as hardcoded not fixing the problem.</p>