There was a good suggestion about using the MessageStoreInterceptor, but I am
really trying to avoid using Session-based storage for my application,
having been indoctrinated into the RESTful camp at the 2007 Colorado
Software Summit :)

I just discovered that both actions (the one that gets the validation errors
and the target of the chain result) are on the OGNL stack.  So, here is what
I did:



>     @Override
>     public String execute()
>         throws Exception
>     {
>         ValueStack stack = ActionContext.getContext().getValueStack();
>         Object penultimate = stack.findValue( "[1].top" );
>         if( penultimate instanceof ValidationAware )
>         {
>             ValidationAware previousAction = (ValidationAware)
> penultimate;
>             this.setActionErrors( previousAction.getActionErrors() );
>             this.setActionMessages( previousAction.getActionMessages() );
>             this.setFieldErrors( previousAction.getFieldErrors() );
>         }
>         return SUCCESS;
>     }
> 

I like this approach because it seems clean.  But, I am wondering, given the
fact that bean properties are set in the second action, why aren't
"actionErrors", "actionMessages", and "fieldErrors" seen as bean properties
that get automatically set by the ChainingInterceptor?

Anyway, this solution is working for me, and I think I should abstract this
out into an interceptor so that I don't have to pollute my action methods
with this logic.  Does anyone have any feedback about this approach?  Am I
abusing the OGNL stack?  Am I breaking semantics of validation handling?  Is
it possible that the first action will not be located on the stack as
"[1].top"?

Thanks for your help!


jjgould wrote:
> 
> Ted, et. al.,
> 
> I am also interested in accessing the previous action from the target
> action of a "chain" result.  But, the reason I want to get to that action
> is not because of any bean properties, but because I need the action
> errors, action messages, and field errors that may have been placed there
> by my validation.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Manually-obtain-previous-action-parameters-after-action-%22chaining%22--tf4601173.html#a13647964
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to