PDA

View Full Version : Some advise to maintain a session object


csanchez
Aug 9th, 2007, 11:07 AM
Hello, I'm working in a project that show a list of results (also permit add and delete items) of several dynamic searchs. Each search has its own metadata that defined it (where the data is, fields to show, etc). We use this metadata to build the list, search criteria and add form.

Then we have a menu that shows an item for each search. for example:
Car (url list.htm?searchType=car)
Motorbike (url list.htm?searchType=motorbike)

The parameter "searchType" describe witch is the search to work on. When the user chooses the item 'car' the system shows a list of cars and permit to filter the result, to add new one or to delete some car from the list (the same happens if the user choose another item). So when a user choose an item it's very important to mantein in session the searchType.
I use an RedisplayingSearchFormController (thanks Jörg Heinicke) for the result and filter list page, and a SimpleFormController for add page.
But I dont find an elegant way to manage the searchType. Maybe with a filter or an interceptor when item menu is choosed.

Finally the question: is there an usual way to manage this situation? or can SWF help me?

Thanks, Claudio (apologize for my english...)

Jörg Heinicke
Aug 10th, 2007, 12:07 AM
So when a user choose an item it's very important to mantein in session the searchType.

I used to manage global state like user preferences (which is your user's choice in the wider sense) in a session-scoped (http://static.springframework.org/spring/docs/2.0.x/reference/beans.html#beans-factory-scopes-global-session) bean.

Joerg