title: How can I pass variables state from one page to another, if both pages use the same controller, but the second page uses a controller extension?
body: <p>I have a page that needs to pass data to another page. They both use the same controller, but the second page has its own controller extension. When the first page passes data to the second page, the second page will recall the constructor of the controller. If I remove the controller extension from the second page, data can be passed and the constructor is only called on the first page, not on the second.</p>
  
  <p>How can I pass state from one page to another, if both pages use the same controller, but one page uses a controller extension?</p>
  
  <p>For example, in the following code, if I enter data in the outputText for the variable t and then go to the next page, the state won't save, the constructor will be recalled, and the value for t on page 2 will be "construct". If the testExtension is removed from the second page, then everything works fine.</p>
  
  <p>apex/test1
  VisualForce</p>
  
  <pre><code>&lt;apex:page controller="test"&gt;
      &lt;apex:outputText value="{!t}" /&gt;
      &lt;apex:commandButton action="/test2" value="Go to test2" /&gt;
  &lt;/apex:page&gt;
  </code></pre>
  
  <p>Controller </p>
  
  <pre><code>class test {
      public String t {get; set;}
      public test() {
          t = 'construct';
      }
  }
  </code></pre>
  
  <p>apex/test2 VisaulForce</p>
  
  <pre><code>&lt;apex:page controller="test" extension="testExtension"&gt;
      &lt;apex:outputLabel value="{!t}" /&gt;
  &lt;/apex:page&gt;
  </code></pre>
  
  <p>controller extension:</p>
  
  <pre><code>class testExtension {
      public testExtension(test controller) {  
      }
  }
  </code></pre>