[SalesForce] apex:Include and pagereference Issue

Strucked with a different kind of Issue.

I'm having three pages page1,page2,page3. I have Included all this pages in a single page by using apex:include like this

<div id="apiaccount" class="tab-pane">
      <apex:include pageName="page1">
</div>
<div id="contactandaccount" class="tab-pane" style="display:none;">
      <apex:include pageName="page2">
</div>
<div id="apiaccount" class="tab-pane" style="display:none;">
      <apex:include pageName="page3">
</div>

and it displays as something like this
enter image description here

Now what my problem here is when I click on Update Account Settings in page2,it is redirecting to page1 as I have Pagereference as null.
I can't redirect it to page2 since my page2 looks like this without the <div> components beside

enter image description here

and their will be a View change for the users here.
I cant add div components to page2 as their will be double values of div reflected When I click on contacts and Accounts tab.Hope the question is clear.
What would be the Solution to redirect to page2 without changing the view for the Users

My controller class is

public pagereference update_account(){
      if(condition){
         ApexPages.Message successMsg= new ApexPages.Message(ApexPages.severity.INFO, 'Settings updated successfully');  
            ApexPages.addMessage(successMsg);
       }else{
           ApexPages.Message successMsg= new ApexPages.Message(ApexPages.severity.Error, 'An Error Occured');  
            ApexPages.addMessage(successMsg);
       }

             p = new PageReference('/apex/cnpAccount');
             p.setRedirect(true);
            return null;
}

Best Answer

You can use the rerender attribute of the action button to limit the scope of the refresh. In this case you don't want the whole page to refresh, just the area inside your "Account Settings" section. Is that a pageblocksection?
If it is e.g. <apex:pageBlockSection id="AccountSetSection"...
Then your button could include rerender="AccountSetSection"