You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darren James <jd...@netflix.com> on 2008/02/28 01:10:52 UTC

freemaker model population

Hi all,

I'm fairly new to freemarker, and just started using in in the context 
of a struts2
component tag.  I was noticing that it seems like you can do this

  ${foo.bar}

anywhere in the template (vs. using the s.property tag), *but* only when
the top object on the value stack is the object with property foo. 

....so my question is, how does struts populate freemarker's model, and 
is there
a way to make ${foo.bar} be evaluated in the context of any object on the
value stack.

thanks,

- darren.

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


Re: freemaker model population

Posted by Darren James <jd...@netflix.com>.
Sorry for the confusing question.  I tried this again and it seemed to 
work fine
(i.e. accessing objects that are not on the top of the value stack via 
ognl expressions
via the ${foo} syntax in freemarker templates)....

However, I did find a couple of places where I had to use the struts 
property tag
instead. For example

<s:set name="foo" value="bar.baz"/>

I could not use ${#foo}, I had to use <s:property value="#foo"/>.

Are there any other gotchas with ${} vs. <s:property value=""/>

thanks peeps,

- darren.


Darren James wrote:
> Hi all,
>
> I'm fairly new to freemarker, and just started using in in the context 
> of a struts2
> component tag.  I was noticing that it seems like you can do this
>
>  ${foo.bar}
>
> anywhere in the template (vs. using the s.property tag), *but* only when
> the top object on the value stack is the object with property foo.
> ....so my question is, how does struts populate freemarker's model, 
> and is there
> a way to make ${foo.bar} be evaluated in the context of any object on the
> value stack.
>
> thanks,
>
> - darren.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

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