I have a page showing a list (datatable) of objects, lets say different countries. The table is backed by a CountryListManager. Every row has a link to a details page. The details page has some data and a list of the country's biggest cities. This list is backed by a CityListManager, the page itself by a CountryDetailBean. Each row in the city list also has a link to a city detail page, backed by a CityDetailPage...
I implemented this by using nested conversations, starting every time a details link is clicked. This works great!
But now I want to add buttons to the details pages for jumping to the next or previous list entry. For this to work I can't use nested conversations anymore: I need to have the ListManger in the same conversation as the corresponding details bean (that backs the buttons and manipulates the ListManager).
I could implement this by merging the conversations instead of nesting them, but I would loose the nice cleanup functionality.
I'd like a solution like this one:
- make the CountryListManager request scoped
- when clicking the details link start a new conversation containing the CountryDetailBean and pass the ListManager to the DetailManager (it has get/setListManager). The ListManager is now conversation scoped as it is a property of the DetailBean
- (same thing for CityListManager/CityDetailBean...)
- when going back to the list page, I'd like to be able to set the DetailBean's ListManager instance as the listManager to use
This way I still could use nested conversations.
Is there a way to do this? Or is there a much simpler solution, I am too blind to see?
Thanks in advance!