Jul 21st, 2006, 07:18 AM
Basic MVC session state tracking question
I have a pretty simple scenario:
a single page with two sets of tabs on it.
a model/command class that keeps track of which two tabs are currently selected
a controller that grabs the command, and updates the model for the jsp to set the data to be displayed for the two currently selected tabs.
At the moment, when my onSubmit method is called, the (say) currentTab2 field is set with whatever I set it to when I clicked on the tab in my JSP. But currentTab1 is set to the default value as defined in the command bean, every time. This I assume is because a new command bean is created every time.
In Struts I would have my ActionForm in the session so that it could be used for the tracking of the two tabs current states.
How can I do the following:
having set currentTab1 and currentTab2 to defaults in an initial controller which then forwards on to my page Controller, keep the command bean available across multiple requests, so that if I update one current tab to be something else, the other stays the same ?
I assume I just make the command bean available to the session scope.
a) how do I do that (setSessionForm(true) ? )
b) how do I force the creation of an HttpSession if one is not there (as it's required).
All this seems really basic but I am obviously missing somthing here....