I have some crud pages for which I have to store some state information, like current page, records per page, current order, filter conditions, and sometimes way more information…
I’d like to use friendly urls similar to rest style, something like http://microformats.org/wiki/rest/urls (GET for browsing, POST to add, PUT to edit, DELETE to remove)
The problem with cookies is that if I open several tabs, all of them would share the same cookies, it’s the same with the session because the session id is stored in a cookie
if I try to keep those params in the url (something like GET /clients?page=1&len=10&sort=name&filter=smith) as soon as I issue a POST I loose those values
the other solution would be to store the state on hidden inputs, and to always issue posts carrying around those hidden inputs, but in that case I can’t use GET for queries…
so, how do you handle web presentation state???
—
added:
to be more specific
I have a crud page, the user can filter, change page, page length, and
sort order..
After issuing an update or insert, how can I retrieve the former page,
page length, sort order, criteria filters (that presentation logic
state), etc… taking into account that if the user opens another tab
both tabs would work with the same cookies…
the only solution I can think of is to use hidden fields…
You’d have to do both of your suggestions, I think.
Whenever you generate a page server-side, make sure any of the forms on the page have your params as hidden values, and any links have the params in the URL…