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?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
According to visualforce guide > pageReference > setRedirect https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_PageReference_setRedirect.htm:
In other words, if you want the controller to be reinstantiated (and hence the constructor reinvoked), in the pageReference method, use
But, if you don't want the controller class to be reinstantiated, use