In a recent message, I described a problem I had with the model object of a ModelDriven action. The model object is pushed onto the top of the stack by the ModelDrivenInterceptor but after updates to the model in the action, the value at the top of the stack isn't the same as the updated model.
I've tried to push the updated value back onto the stack, with the push() method in two different ways: 1) By updating the modeldriveninterceptor to push on both "before" and (new) "after". This is done as follows: protected void after(ActionInvocation dispatcher, String result) throws Exception { pushModel(dispatcher); } protected void before(ActionInvocation invocation) throws Exception { pushModel(invocation); } private void pushModel(ActionInvocation invocation) { Action action = invocation.getProxy().getAction(); if (action instanceof ModelDriven) { ModelDriven modelDriven = (ModelDriven) action; OgnlValueStack stack = invocation.getStack(); stack.push(modelDriven.getModel()); } } 2) Call "push(model)" directly in the action after a load. The first approach doesn't seem to work, probably because I'm dealing with the input params on "after" incorrectly. The second approach does work. So, some questions: 1) Is there something wrong with how I've rigged the modeldriveninterceptor to work that would prevent it from pushing properly? 2) Does it make sense to try to push in both "before" and "after" in the modeldriveninterceptor anyway, or is this violating some part of the design of the interceptor? 3) If I go the second route, with a "push" call in the action, do I need to call "pop" first to get the old model object off of the stack? 4) Or, all of this aside, is there something I'm missing about why the top of the stack isn't staying in synch with the model object? It looks like "pop" is just adding an element to an array at element 0, so I would think that it would be putting it there by reference. But the "add" method of ArrayList (which CompoundRoot extends) does call "arraycopy", which might be what's causing things (perhaps) to be copied by value instead of reference. Not sure, though, if that's what's causing the overall problem. Thanks, Drew ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork