1) Your interceptor stack is fine.

2) Dale was simply pointing out a very common newbie mistake; when you
specify an interceptor-ref in an action it will replace (not append) the
interceptor stack. Since you hadn't shown what redirectInput was it was a
possible source of error.  Now you have shown it, we can see it is OK. (see
#1)

3) Result type of Chain is still probably the answer for you.  You say it
didn't work but don't describe what that means and what exactly you tried.
(see note below)

4) You should not need to iterate over
#session.RedirectMessageInterceptor_FieldErrors to get the errors from the
RedirectMessageInterceptor.  This is not the way it is meant to be used,
it's suppose to handle the messages automatically, that's the whole point of
it.

In order for RedirectMessageInterceptor to work properly you need to always
include it in your interceptor stack on both the actions that generate the
messages and on the actions that get redirected to.  This is explained in
the doc and comments for RedirectMessageInterceptor.

Note that the action that you redirect to, following a validation error,
will always use the 'input' result since the presents of the error messages
will cause the workflow interceptor to return a result of 'input'.  You
might want to read this over a couple times to make sure you get it. The
action you redirect to will return a result of 'input' because the workflow
interceptor sees that there are errors. (Maybe this is why you though chain
wasn't working).

You seem to have such an unusual configuration that you may have to develop
your own solutions since the standard ones don't seem to work for you.  As I
explained earlier, doing a redirect following a validation error is almost
always the wrong thing to do and the standard approach is to dispatch back
to the input page.


On Fri, Oct 30, 2009 at 1:57 PM, Siddiq Syed <siddiq...@yahoo.com> wrote:

>
> The interceptor mention is nothing but
> RedirectMessageInterceptor(
> http://glindholm.wordpress.com/category/struts-2/)
> and I specified that in the strust.xml,
> This interceptor is to preserve the error messages.
>
> <interceptors>
> <interceptor name="redirectMessage"
> class="com.interceptor.RedirectMessageInterceptor" />
>                        <interceptor-stack name="redirectInput">
>                                <interceptor-ref name="redirectMessage" />
>                                <interceptor-ref
> name="paramsPrepareParamsStack" />
>                        </interceptor-stack>
>                </interceptors>
> I am iterating the session in the JSP and displaying the error messages..
>
> <s:if test="#session.RedirectMessageInterceptor_FieldErrors != null">
> <ul>
>  <s:iterator value="#session.RedirectMessageInterceptor_FieldErrors" >
>        <s:iterator id="id" value="value" >
>        <li><s:property value="id" /></li>
>  </s:iterator>
> </s:iterator>
> </ul>
> <%
>        session.removeAttribute("RedirectMessageInterceptor_FieldErrors");
> %>
> </s:if>
>
> As I said my first attempt was to use Chain , but It was not working.
> And I don't understand what Dale is saying , can you elaborate please.
>
> Dale -- you mean to say chain and interceptor doesnot go together. !! -:(
>
>
> Thanks
> Siddiq.
>
>
> DNewfield wrote:
> >
> > Greg Lindholm wrote:
> >> The only other thing is your interceptor stack 'redirectInput' you
> >> haven't
> >> shown what it is.
> >
> > And note--specifying any interceptor(s) in the action causes the
> > specified interceptor(s) to be the only ones used.
> >
> > -Dale
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Preserving-Messages-and-Garbage-values-Across-a-Redirect-in-Struts-2-tp26114968p26134455.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to