struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Law <andy....@roslin.ed.ac.uk>
Subject Re: Interceptor order
Date Thu, 20 May 2010 16:07:45 GMT

Cheers Chris,


Chris Pratt wrote:
> 
> You may want to think about using:
> 
> invocation.getStack().getContext().put(MAGIC_KEY,getStuff());
> 
> instead of:
> 
> invocation.getStack().set(MAGIC_KEY,getStuff());
> 
> For the sake of argument, I'm going to assume that MAGIC_KEY is set to the
> String "magic".  The first example above makes #magic available in the
> Value
> Stack's context, so you can simply use <s:property
> value="%{#magic.gathering}"/> in your JSP to effectively give the same
> results as a call to getStuff().getGathering().  Whereas the second
> example
> changes the stack itself, which may be what's interfering with the other
> interceptors.
> 


Is this documented anywhere? For the record, I would be looking for a great
big flashing Red sign saying "If you use the set() routine on the ValueStack
you'll silently blow away all the parameter handling code" for completeness
but I never found one of those yet.

Also for the record, using the set(MAGIC_KEY, this.getStuff()) call makes
'magic' available directly so I can reference it as <s:property
value="magic.gathering" />. I'm not clear in my mind how the alternative
version is better (other than your assertion that it will work :o}).

Later,
Andy 

-- 
View this message in context: http://old.nabble.com/Interceptor-order-tp28597967p28623423.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message