To continue, the first one (probably; I'm still a
little fuzzy on OGNL sometimes) works because if a
property isn't found in the action it will continue
looking on the stack until it finds it or runs out.

Now, as to why #2 "doesn't work", I'm a little hazier
on that: perhaps when OGNL has an expression tree it
does lookup a bit differently or something?

d.

--- Musachy Barroso <[EMAIL PROTECTED]> wrote:

> in OGNL there is always an object that is the
> "root", so %{name} is
> actually calling root.getName(). The "#" is used to
> reference
> something else than the root. In your views, your
> action will be the
> OGNL root (unless some tag pushes something to the
> stack), to refer to
> your property you would need #contextKey.
> 
> 
> musachy
> 
> On Nov 8, 2007 7:13 AM, J&M <[EMAIL PROTECTED]>
> wrote:
> >
> > Hi,
> >
> > Can any body explain the following to me, I don't
> quite grok it. I have
> > added a property value via my action
> >
> > ActionContext ctx = ActionContext.getContext();
> > ctx.put("contextKey", "developer.page.logout");
> >
> > In the jsp I have the following:
> >
> > 1 <s:property value="%{contextKey}"/>
> > 2 <s:property value='%{contextKey+".title"}'/>
> > 3 <s:property value='%{#contextKey+".title"}'/>
> > 4 <s:property value='%{"string1"+".title"}'/>
> >
> > This results in an output:
> >
> > 1 developer.page.logout
> > 2 null.title
> > 3 developer.page.logout.title
> > 4 string1.title
> >
> > Why does 2 give me a null output and 1 not, and 3
> give me what I want.
> > What is the significance of the # in this case?
> >
> > Cheers
> >     Caleb.
> >
> > --
> > View this message in context:
>
http://www.nabble.com/OGNL-struts-property-tf4770568.html#a13645884
> > Sent from the Struts - User mailing list archive
> at Nabble.com.
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?"
> Pink Floyd
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to