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

Apex:page action attribute limitation??


Does any1 have any idea about limitations of the things that can be done from an action method in an apex:page tag

I have an action method in apex:page tag which redirects user to another VF page but its not working.

What I observed that the VF page redirected to other VF page only when the controller of the other VF page was different than its own but when I redirected to a VF page having the same controller its just dint do it!!


I also tried it by switching off the development mode but it dint work. Has nay1 faced any such kind of issue & if so how can some1 resolve it!!


Please check code here.


Try the code given below. It works for two pages having one controller :


                 public class cls_redirect1


                       Public PageReference PageRefresh()


                                PageReference pr = new PageReference('/apex/testconfirmation');


                                return pr;



Hope this helps.


Thanks Pradeep for that. But I want to mantain the controller variables so I cant use setredirect(true). Do you have nay idea how to redirect with setredirect(false) if controller is same as its not redirecting!!


Did you work out how to do this. I have the same issue - the debug logs show I am redirecting to another page (on the same controller) but it does not render it - stays on the same page.   Replacing my page reference to it does work - so you seem to be right that on the same controller this does not work.


Did you work out a way forward ?





Nope I still havent got it. NO luck yet!!!!

I have a workaround for this. Have a boolean variable in your controller and Initialize it to false. Within the action method, set it to true if you like to redirect to another VF page that uses the same controller as the current page.

The below javascript function will let you redirect to another VF page when the variable is true.

window.onload = function() {
        if ( {!wantToRedirect} ){
              window.location = '/apex/anotherVFpage';