struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cimballi <cimba...@cimballi.net>
Subject Re: Add ValueStack Object In Interceptor
Date Fri, 13 Aug 2010 18:42:37 GMT
Chris, the ParametersInterceptor clears the ValueStack, so depending
on your stack maybe that's what's happening.

Cimballi


On Fri, Aug 13, 2010 at 1:09 PM, CRANFORD, CHRIS
<Chris.Cranford@setech.com> wrote:
> I am trying to add an object to the ValueStack prior to invoking the
> action; however my action is not able to see the added value in the
> stack.  What is wrong with this code?
>
> // Interceptor method
> @Override
> public String intercept(ActionInvocation invocation)
> throws Exception {
>  ValueStack stack = ActionContext.getContext().getValueStack();
>  stack.setValue("my.test.key", new String("Hello World"));
>  return invocation.invoke();
> }
>
> // In Action Class
> public String testMethod()
> throws Exception {
>  String s = (String)
> ActionContext.getContext().getValueStack().findValue("my.test.key");
>  log.debug("my.test.key : " + (s != null ? s : "<null>");
> }
>
> I constantly get "my.test.key : <null>".
>
> Why?
>
> Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Cimballi
Freelance - JAVA J2EE project leader
http://cimballi.elance.com/

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


Mime
View raw message