struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jotpe <jotpe....@gmail.com>
Subject Re: paramsPrepareParamsStack only populates pojo, neither String nor int
Date Mon, 16 Dec 2013 09:44:42 GMT
Thanks for reply!

Sorry, my fault: I explained not everything well.
I do not need access the User object in my navigation interceptor. They
have no contact points!
I just execute the interceptor before the paramsPrepareParamsStack to be
sure the navigation content gets generated, before the validate method
detects maybe field errors... which would broke the interceptor chain.

What happens conrete in my case:
Html content is generated by the navigator interceptor. If the interceptor
stores it into the value stack (before invocation.invoke()) => my String
object passwordRepetition stays null in my action class. Without calling
ValueStack.set(String,Object) => passwordRepetition is populated well!

> or you can replicate the paramsPrepareParamsStack
into your new stack and put your navigation interceptor anywhere in that
stack you want.
  (*Chris*)

This is a good idea to integrate custom interceptors, which needs already
populated class properties. But in this case, there's no need.


Regards Johannes


2013/12/13 Chris Pratt <thechrispratt@gmail.com>

> I'm guessing that the user fields aren't actually getting set (since that's
> done by the params interceptor that hasn't run yet), but you're seeing the
> existing values of the object.  The passwordRepetition is showing null, but
> it similarly hasn't been set by the params interceptor.
>
> You can either call the params interceptor one more time before your
> navigation interceptor or you can replicate the paramsPrepareParamsStack
> into your new stack and put your navigation interceptor anywhere in that
> stack you want.
>   (*Chris*)
>
>
> On Fri, Dec 13, 2013 at 6:53 AM, jotpe <jotpe.osm@gmail.com> wrote:
>
> > Hello List,
> >
> > I build myself a custom interceptorstack. The core part has to be the
> > paramsPrepareParamsStack, because i work with an or-mapper.
> >
> >     <interceptor-stack name="accessNavigationDialog">
> >                 <interceptor-ref name="checkRoles" />
> >                 <interceptor-ref name="navigation" />
> >                 <interceptor-ref name="paramsPrepareParamsStack" />
> >                 <interceptor-ref name="paginator" />
> >    </interceptor-stack>
> >
> >
> > In my action class, there are 2 variables:
> >
> >     private User user;
> >     private String passwordRepetition;
> >
> >
> > POST Parameters are for example:
> >
> > user.id=14
> > user.password=secret
> > passwordRepetition=secret
> >
> >
> > Everthing is working fine, if the navigation interceptor is executed
> after
> > the paramsPrepareParamsStack. But i need to execute it before, because no
> > navigation content is generated in case of error detection in a validate
> > method.
> >
> > Is the navigation interceptor executed befor the paramsPrepareParamsStack
> > the user varianbles id and passwort are set proper:
> > user.id=1
> > user.password=secret
> >
> > but setPasswordRepetition is never called and passwordRepetition stays
> > null!!!
> >
> >
> > The navigation interceptor only generates some html content and saves it
> in
> > the value stack. Is this no good idea? It's done in this way:
> >
> > ValueStack vs = ActionContext.getContext().getValueStack();
> > vs.set("servicenav","<ul>...</ul>");
> > return invocation.invoke();
> >
> > Can please anyone help me? This kind of error, raises a some distrust in
> > me...
> >
> > regards Johannes
> >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message