stateful application and browser's back button
Hello,
The requirements of my stateful application are as follows.
1. Support for back button. i.e, User changes should be preserved.
2. Full application state available across different pages of the application.
To address these requirements, I developed a test application comprised of 2 pages, A and B, and an ApplicationState object. ApplicationState object consists of 2 string objects.
Page A has a form which contains a textfield(input type) and submit button. The textfield is bound to one of the string objects in application state object. Page B also has form, textfield and submit button. The textfield is bound to another string object in application state object.
The user can go from page A to B by clicking on submit button on page A. Similarly, user can go from page B to A by clicking on submit button on page B.
I configured my application to use CONTINUATION and put my form object in CONVERSATION scope.
With this configuration, test sequence A works as expected, but test sequence B breaks requirement 1 (Support for back button. User changes should be preserved).
Test Sequence A.
1. Load Page A. textfield is with filled quot;Default_Value_Aquot;
2. change textfield contents to quot;abcquot;. textField_A = quot;abcquot;
3. click on submit.
4. Page B loads. textfield is with filled quot;Default_Value_Bquot;
5. click brower's back button.
6. Page A shows quot;abcquot;.
Test Sequence B.
Steps 1 to 4 are same as in Test Sequence A.
5. change textfield contents to quot;xyzquot;.
6. click on submit.
7. Page A loads. textField_A = quot;abcquot; [Good. This is expected]
8. change textfield contents to quot;defquot; textField_A = quot;defquot;
9. click on submit.
10. Page B loads. textField_B = quot;xyzquot; [Good. This is expected]
11. Click brower's back button.
12. Page A loads. textField_A = quot;defquot; [Good. As expected. Same as in step 8].
13. Click brower's back button.
14. Page B loads. textField_B = quot;xyzquot; [Good. This is expected]
15. Click brower's back button.
16. Page A loads. textField_A = quot;defquot; [BAD. Because at this point in time, user had provided quot;abcquot; as value for textField_A, so the browser should load quot;abcquot;.]
What needs to be done to keep history of user provided values and load them appropriately when user keeps clicking browser's back button.
Thanks
Prakash
Your analysis is correct but SWF does not provide this kind of flow execution management out of the box.
If you want the history, you need to use flowScope which will cause the values to be stored inside the continuation snapshot, so you always jump back to the values available 'at that time'. This ofcourse has the side-effect that edits seem to be 'undone' when you go back, but that's basically what you seem to want in step 16.
By using conversation scope, you've only got a single ApplicationState object, which explains what you see in your scenario.
IMHO your expectation in step 16 violates your first requirement: quot;User changes should be preservedquot;. The last user change to textField_A set the value to quot;defquot;, which is what is displayed, basically quot;preserving user changesquot;.
Erwin |