I'm having an issue with the Scope interceptor provided in Struts 220.127.116.11. It works great for putting the specified object into my session and prepopulating it with the data recieved from struts forms. However, when I complete the final step I would expect that the session would be cleaned up (i.e. my object removed automatically by Struts). Struts is not doing this cleanup nor throwing any error or warning to indicate why.
I've pasted my config xml file for this particular package below. I know that this functionality is usually reserved for 'Wizard like' interfaces, but I'm using this basic 2 jsp example to illustrate my point. I start using the scope interceptor in action initCostType and I end in editCostType.
initCostType is used for preparing and displaying my values for user input.
editCostType is used for storing the data. I know that normally you should not have your save action the same as your end of scope, but it doesn't make a difference as far as I can tell. Please prove me wrong.
Has anyone else experienced this issue? The more research I do the more books I find stating how to use the scope interceptor. However, if I copy and paste the examples given in my IDE and run them, there is no session cleanup. I'm starting to suspect it's a Struts 18.104.22.168 problem.
What's the flow you're taking through the app, and where/how are you determining the value is still in session? I mean, the code to remove the value is in the interceptor (see below), and it's pretty much the same as adding the object to the session, except in reverse.I can't do any testing of this at the moment, but I'll try to remember to look at this tomorrow.
(My initial guess is that using "scope.type" as a parameter name when you're directly referencing an interceptor won't work; that's really only intended for when you're dealing with a stack of interceptors, and I'm not sure that OGNL would figure out what you mean. I don't know if I'll be able to test that tonight, though.)
Reproducible using the incorrect param name "scope.type"; try using the correct param name "type".
Edit: In my test code it's only the "end" scope.type param that causes a problem--because of the way the interceptor is written.
In other words, the "start" action may work with the incorrect param name, but the "end" action will not. Do it right in both places, however, as there may be circumstances under which a mis-configured "start" action would cause issues.
Joined: Jun 03, 2009
Just tested what you believed to be the problem (i.e. 'scope.type' should be 'type'). You are correct. That is exactly what my problem was. Now, if I go completely through the wizard in my application, the Scope interceptor does clean up my session.