You need to sign in to do that
Don't have an account?
steve_andersen
Mulitple VF pages with one controller: controlling app state
I've set up 3 VF pages to use one controller. As I navigate from page to page, certain state data is being held in variables in the controller. It generally works.
However, the URL in the address bar isn't showing the correct page. I start on page A and when I move to page B via a command link, the URL isn't updating. It appears to stay one page behind.
Here's an example of how I'm moving from one page to the next:
If I set the Redirect parameter to true, the URL changes but I also lose my state information.
What am I missing about navigating between pages while not reinstantiating my controller?
Thanks,
Steve
However, the URL in the address bar isn't showing the correct page. I start on page A and when I move to page B via a command link, the URL isn't updating. It appears to stay one page behind.
Here's an example of how I'm moving from one page to the next:
Code:
public PageReference loadCallList() { //set the current campaign //set the list of members setCallListMembers(); //redirect to the call list page return Page.callList; }
If I set the Redirect parameter to true, the URL changes but I also lose my state information.
What am I missing about navigating between pages while not reinstantiating my controller?
Thanks,
Steve
To me it seems normal behaviour (just as with Struts and JSF).
The server processes your request and the Java code there (which is actually running the show) does a server side 'forward'. It is basically tunneling the request to code responsible for building the next page without the browser being aware of it (this code also keeps track of your viewstate and in-memory variables). That's why your url always is one page behind.
The other option that exists is a 'redirect' which basically sends an answer back to the browser telling it to 'redirect' (basically perform a 'brand new' http GET) to another page (loosing the in memory viewstate).
Check out any JSF based website and you'll see the same behaviour.
David
I broke out the controllers to 1 per page and passed my variables on the querystring. Works great.
Steve