title: Can you prevent a VisualForce component from rendering until it's contents become visible?
body: <p>I have a VisualForce page that contains two components which are each inside of a tab, like this:</p>
  
  <pre><code>&lt;apex:tabpanel switchtype="ajax" selectedTab="tab1"&gt;
      &lt;apex:tab label="First Tab" name="tab1" id="tab1"&gt;
       &lt;c:firstComponent /&gt; 
      &lt;/apex:tab&gt;
      &lt;apex:tab label="Second Tab" name="tab2" id="tab2"&gt;
      &lt;c:secondComponent /&gt;
      &lt;/apex:tab&gt;
  &lt;/apex:tabpanel&gt;   
  </code></pre>
  
  <p>Is it possible to prevent the page from running the code in secondComponent (contained in tab2) until the user actually clicks on the second tab?</p>
  
  <p>This is a specific case, of the more general question: is it possible to NOT run all of the code on a page when it first loads and only run it when the user takes a particular action.</p>
  
  <p>(One reason for wanting to do this is to reduce the number of queries on the page to avoid hitting the limit.)</p>