0

I have two Visualforce pages for example Page1 and Page2. From Page1 method, by using Page reference I am calling Page2. In Page2 controller constructor, i am executing code that code has to be executed when ever controller called from Page2, not from Page1.

Page1 Code

PageReference   pageRef = new PageReference('/apex/page2?data='+i+'');
        pageRef.setRedirect(true);

in Page2 constructor

public page2Constructor() {
  panel = true;
}

Above panel=true needs to execute whenever it called from Page2, not from Page1.

1
  • 2
    Why not add a flag to the querystring and check it on load ? I.e ?loader=page1&data=
    – JamesKn
    Commented Jul 4, 2017 at 15:34

1 Answer 1

0

When setRedirect is set to true a redirect is performed through a client side redirect which means all actions will be client side the the newly added page constructor will not be called, url will also not be changed and view state will also be maintained on the page

You must log in to answer this question.

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