You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jimski <ji...@gmail.com> on 2008/04/04 19:20:21 UTC

Re: Struts 2 exception problem

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.  

Have you managed to make any progress on this?








oguzhan tortop wrote:
> 
> 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 <og...@yahoo.com> 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 :/
>> 
>> How is an Action.ERROR normally handled with the stack
>> you have defined? Is there a global result?
>> 
>> d.
>> 
>> 
>> 
>> 
>>  
>> ____________________________________________________________________________________
>> Need Mail bonding?
>> Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
>> http://answers.yahoo.com/dir/?link=list&sid=396546091
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-2-exception-problem-tp9835135p16494148.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org