hi,
I'm wondering if there is a good/right way of updating data that is shown using a RefreshablePageListHolder.
I've got a controller (AbstractController) that is using a RefreshablePagedListHolder to show a list of objects which are stored in the database. To edit those objects I've created a separate controller (SimpleFormController). I'm using Hibernate for persistence.
Now my problem: after submitting the changes in the SimpleFormController the database gets updated, but since my list of items in the RefreshablePageListholder is cached in the session the change doesn't show up there.
I've thought about forcing the listholder to update its data from the db, but that more or less defeats the purpose of caching it in the first place. I've also thought about trying to get a reference to the object in the listHolder from the edit form instead of getting a 'fresh' object from the database, but that couples the edit form to the list view - that doesn't seem right to me.
I was hoping someone here could point me in the right direction.
Simon
I went with the previous solution, and it worked out fine. I implemented the Listing Controller to check for a quot;refreshquot; parameter. When present, it invokes RefreshablePagedListHolder.refresh(true). Then I set the successView of my SimpleFormController to 'redirect:/list.do?refresh'.
Somewhat cumbersome, but it works. |