Did you try to put the value in the context?

invocation.getStack().getContext().put("myValueStackName",
> theValueIwantForThisName);


Twitter     :http://www.twitter.com/m_cucchiara
G+          :https://plus.google.com/107903711540963855921
Linkedin    :http://www.linkedin.com/in/mauriziocucchiara
VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara

Maurizio Cucchiara


On 30 November 2012 14:42, Eric Lentz <ericle...@outfastsource.com> wrote:

> Inside of an interceptor, I'd like to add a value onto the the ValueStack.
> What is the best way to do this?
>
> I tried this:
> invocation.getStack().set("myValueStackName", theValueIwantForThisName);
>
> But that pushes that value to the top of the stack, pushing my action class
> down which becomes problematic for values getting assigned to the action
> class. For example, a JSP field with name="fooId" and an action class with
> a field of Long fooId. When I have the above code, fooId doesn't get
> assigned. When I don't, it works as you would expect.
>
> I guess my interceptor could be later in the stack of interceptors, after
> the ParametersInterceptor, but that seems fragile. Some other developer
> could come along and move it and now there are bugs. Plus, I'd prefer this
> particular interceptor be at or near the beginning of the list of
> interceptors.
>
> So, how do I assign, but leave the action class at the top of the stack? I
> could pop the action, add my value and then add the action back on, but is
> there a better way?
>
> - Eric
>

Reply via email to