I am following the book Visualforce Developer's Guide. There is one thing I am not quite clear with: when multiple VF pages are using one single controller - like in a wizard, how do VF decide when to create a new controller class instance and when will it use a previous one?
According to visualforce guide > pageReference > setRedirect https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_PageReference_setRedirect.htm:
setRedirect(false), the redirect is a server-side forward that preserves the view state if and only if the target page uses the same controller and contains the proper subset of extensions used by the source page.
In other words, if you want the controller to be reinstantiated (and hence the constructor reinvoked), in the pageReference method, use
pgRef.setRedirect(true). The next page is loaded with the whole controller reinstantiated via its constructor.
But, if you don't want the controller class to be reinstantiated, use
pgRef.setRedirect(false). the next page is loaded without re-construction.