Fine tuning back button display when reviewing POST results

Wes Gamble wrote:


However, I'm trying to figure out the best way to handle this when I have actions which POST and redirect back to the _same URL_. For example, I have a page which appends data to a list and then redisplays the updated list. So when you add a list item, you POST, redirect, and GET the same page as before, but now the display page shows the additional item.

Now imagine browsing back through these pages. Because the list display page simply pulls the list object from session, doing a back from the page where there are 3 items will obviously not show me the page with 2 items since the display sees the current state of the model. That makes sense given how the page is generated.

(A BIGGER QUESTION: Should I even be attempting to make concessions for the "page based" view of the application that the back button implies? I already have AJAX actions which change page display without regard for the back button, etc.)

I am not sure if I follow you fully but what would be the point in showing a stale-page when the list of items have already be updated?

Given this sequence...

/list - old list /add_item_post - add item to list and display updated /list /list - updated list

At this point any BACK action to /list will always give you the updated list because the Browser was told to refresh its view of /list.

If you must, perhaps attaching the number of items on the list to the URL may help. For example,

/list - one item /add_item_post /list/2 /add_item_post /list/3 ... etc.