Hi Oguzhan-
We've run into the *exact* same problem. Our interceptor is returning
"error" but that return value is not respected when the result is
rendered. It makes me wonder what the value of returning the invocation
result is in the first place...
Just stepping through the code and browsing the invocation context shows
that the resultCode is set to error just after our interceptor is
invoked. However, when I evaluated the resultCode handed to a
PreResultListener I found it had been set back to success.
I'm a little unsure at this point how to use the PreResultListener to
solve the problem.
I've tried adding it in catch block for the hibernate exception as an
Anonymous Inner Class:
invocation.addPreResultListener(new PreResultListener() {
public void beforeResult(ActionInvocation invocation,
String resultCode) {
ActionContext.getContext().getActionInvocation().setResultCode("error");
}
});
But the beforeResult method is never called even though I can see the
object getting created. I created a separate interceptor to initialize
the listener and that does work but I'm now stuck on finding a method to
signal that listener to set the result code to error appropriately. It
seems that pushing something onto the value stack in my hibernate
interceptor is not useful since the value I put there is being popped
off by someone else. I find the same thing happens when I try adding
values to the request attribute map from an interceptor. At this point
I'm using the session and managing removal of the signal in the
PreResultListener. It's not an approach I like but it works.
Of course it has a global result :) it returns "error" too but i think
struts 2 working mech. makes this impossible to do after
invocation.invoke() method only the result of the action works... :) i
think this is not a common situation
Dave Newton-4 wrote:
--- oguzhan tortop <[EMAIL PROTECTED]> wrote:
> ... but how can i implement a PreResultListener.
I don't think it'll help anyway; sorry.
(Boy, I wish I had my regular machine right now :/