I have a need to implement a multi-page wizard. My thought has been to use the ModelDriven method, and put the model into the user's session and restore it when they come back to the action. Seems simple, but there's always a catch.
The catch is what if the user opens two conversations, say in two different tabs. I really need to have two "models" in their session and a means of discriminating between them. So, is there something in Struts 2 to deal with this scenario already? If there isn't this is what I've thought of, and was about to implement. Add an interface, say "SessionModelAware": public interface SessionModelAware extends ModelDriven { public String getModelId (); public void setModelId (String in); } Any action that needed to track multiple instances of its model in the session would implement this interface. Any view that is using a SessionModelAware action would need to add a hidden field to its HTML form with the modelId property in it. This would allow us to tie back to the model in the users session. Implement an Interceptor that would do the following for ActionInvocation's of actions that implement SessionModelAware: Before the action invocation: 1. Create a Map, sessionModelMap, in the users session to store models, if there isn't one. This map would be keyed on the model id. 2. If there is a modelId in the HttpServletRequest retrieve the model from the users session and set it on the action, use setModel(Object model), also call setModelId(String in) on the action so it would have its id for the next time through. 3. If there is no modelId in the HttpServletRequest generate one and call setModelId(String in) on the action. After the action invocation: 4. Call getModel() on the action and save the model in the sessionModelMap under the modelId. This would allow it to be retrieved on the next run through. Am I on the right track? Is there a better way to do this? Is there something that already does it? Thanks, Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]