I have a requirement to implement visualforce Template approach. As part of that I have page1, page2, page3(VF pages). page1 is the starter and composition page which defines content(empty for now) for page2. Again page2 plays the role of composition page here defining content for page3. Page 3 which is a template defines its own content. Content for page2, page3 should be extracted from the controller instance.

Right now 2 instances of controller are defined one in each of page2, page3. Can't we leverage single instance of controller as the controller is executing twice and most importantly it's taking significant time.

This design is based on the principle of inheritance where page3 behaves as the top base page where unwanted content is modified in the child (page2) by overriding with apex:define. Also to be more specific, page1 acts as selector for choosing right template or page.Lets say here it chose page2.

1 Answer 1


Can you have it all be part of 1 page, broken into 3 sections/s? where each of the 3 sections appear/hide based on user's clicking the Next/Previous buttons?

  • The final output of these pages is to generate a pdf without any user interaction, except the process starter with a custom button. I believe, template and composition should be separate pages. Template and composition are required for our requirement to override pieces of contents and also to maintain several templates with one baseTemplate.
    – pioneer
    Apr 8, 2020 at 17:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .