Asleson, Ryan wrote: > I've thought about writing a PreResultListener <snip/> > I've tried ActionInvocation.getResult(), but it only returns null. > Is there a way to get the current Result object before it is > actually executed?
Looking at the code for DefaultActionInvocation, it seems that createResult() only gets called in executeResult(). If the your add() or remove() methods return an instance of a Result (instead of a String) then I would guess that ActionInvocation.getResult() would return what you expect, though returning a instance of Result may not fit your needs. What's strange is the documentation for DefaultActionInvocation.getResult(), which says: "If the DefaultActionInvocation's result has not been executed before, the Result instance will be created and populated with the result params." The code in DefaultActionInvocation.getResult() doesn't seem to do that functionality though (and the fact that ActionInvocation.getResult() returns null seems like proof). An extremely hacky workaround _may_ be to cast your ActionInvocation to DefaultActionInvocation and then call the public createResult() method (though createResult() will be called twice if you do that: once by you and once by executeResult()). With a little more digging, you may be able to prove that this is a bug in Struts 2. Having said all that, can I backtrack for a second and ask if the following would solve your problem: Could you implement Preparable and have an empty prepare() method, plus prepareAdd() and prepareRemove() methods, each with preparation logic specific to add() and remove(), respectively? Brad Cupit Louisiana State University - UIS --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]