How can I save the last spring-webflow view state id the user visited?
I have an e-learning application with many flows with 10 and more pages. Now I got the task that the user can return to the last visited page of a flow, if he drops out before finishing the flow. So I have to save on every view-state the id on-entry but I don't want to change every 开发者_开发知识库view-state definition manually.
I looked at flow inheritance but then I must at least change every child view-state definition to inherit from a parent view state.
I thought of AOP technique but I don't know where I to put the pointcut.
Any other ideas?
Many Thanks, Nathanael
I am not sure I understand your question completely, an example may help.
Either way, you should take a look at the FlowExecutionListener interface and/or the FlowExecutionListenerAdapter. Creating a class that implements (or extends) one of these will give you hooks into the flow execution lifecycle. The stateEntered(...) method will fire after a transition has completed, giving you access to both the previous state and the new state. Here you could save off the previous state id, either on the flow context, or in a persistent store.
精彩评论