function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
URVASHIURVASHI 

calling page after setredirect(false)

hi 

i am new to salesforce could anyone please help.

i have a problem

i have 3 pages using the same controller

page1

page2

page3

controller1

 

i am calling page2 using

 PageReference page2 = new PageReference('/apex/page2');
  page2.setRedirect(false);
  return page2;

 

i m calling page3 using:

 PageReference newpage = new PageReference('/apex/page3');
  newpage.setRedirect(true);
  return newpage;

 

does setredirect(false) call the page 2 times?

i mean first time when i call the page2, as set redirect is false its url is still showing page1

but next time when i try to call page3 when im on url of page1 but internally from server im on page2

page3 is not displayed n it calls page2 again.

Could you please help or provide an example of calling next pages with setRedirect(false);

with the urls.

 

Thanks.

bob_buzzardbob_buzzard

The setredirect controls whether there is a client-side redirect carried out.  If this is set to false, the URL won't change as the redirect is server side to retain the controller instance.  However, if you set it to true, then the browser will be redirected to the target page, which will drop the controller instance and cause the browser to load the page from scratch.

URVASHIURVASHI

thanks for the reply.

 

Could you please explain with an example of 3 pages using same controller.

 

Thanks.

bob_buzzardbob_buzzard

I don't have time for that I'm afraid - the behaviour you are seeing is correct.

Devendra@SFDCDevendra@SFDC

Hi,

 

You can check out the following link for an example, 

 

http://www.salesforce.com/docs/developer/cookbook/Content/vf_wizard.htm

 

Its a wizard which consist of multiple vf pages and single controller.

URVASHIURVASHI

thanks for the example.