You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by james_carbon5 <ja...@carbonfive.com> on 2007/08/29 20:29:45 UTC
Can anyone explain the leading "r" in OGNL list syntax?
I was trying to figure out how to use a static map, that I created in a
freemarker template, to populate a drop down list, a la:
<@s.select ... list=#{"foo":"foo stuff","bar":"bar stuff"} />
After an hour or so of banging my head into my keyboard I found
http://www.jroller.com/cdaniluk/entry/webwork_and_freemarker_part_deux this
post , where I learned that this will work.
<@s.select ... list=r'#{"foo":"foo stuff","bar":"bar stuff"}' />
Can someone explain what the leading "r" is, or point me to some
documentation that explains what it is and when to use it? I haven't been
able to find any mention of it in the struts 2, freemarker, or ognl language
documentation. Thanks!
--
View this message in context: http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12392943
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
[OT] Re: Can anyone explain the leading "r" in OGNL list syntax?
Posted by Dave Newton <ne...@yahoo.com>.
FYI,
http://fmpp.sourceforge.net/freemarker/versions_2_3.html
gotten by searching for "freemarker +r prefix". Search
for "raw" once you're there.
d.
--- Dave Newton <ne...@yahoo.com> wrote:
> I'd probably try asking this on a FreeMarker list
> since the exception after removing the "r" came from
> FreeMarker.
>
> --- james_carbon5 <ja...@carbonfive.com> wrote:
>
> >
> > Thanks for the response Musachy. So, is the "r"
> > shorthand to let freemarker
> > know that my list is a LinkedHashMap? If not, what
> > is the "r" doing?
> >
> > Thanks again,
> > James
> >
> >
> > Musachy Barroso wrote:
> > >
> > > Do it like:
> > >
> > > list="%{#@java.util.LinkedHashMap@{'Regular' :
> > 'Regular', 'Decaf':
> > > 'Decaf'}}"
> > >
> > > musachy
> > >
> > > On 8/29/07, james_carbon5 <ja...@carbonfive.com>
> > wrote:
> > >>
> > >> Thanks for the response Dale. The "r" isn't a
> > typo. If I remove it I get:
> > >>
> > >> javax.servlet.ServletException:
> > freemarker.core.ParseException: Error on
> > >> line ...
> > >> Found string literal: "foo"
> > >> Expecting: number
> > >>
> > >> etc...
> > >>
> > >> Thanks,
> > >> James
> > >>
> > >>
> > >> DNewfield wrote:
> > >> >
> > >> >
> > >> > I've not written much freemarker, but I'd bet
> > the r is a typo. The
> > >> > important difference between the two tags you
> > have are the single
> > >> quotes
> > >> > around the value of the list attribute.
> > >> >
> > >> > james_carbon5 wrote:
> > >> >> <@s.select ... list=#{"foo":"foo
> > stuff","bar":"bar stuff"} />
> > >> >> <@s.select ... list=r'#{"foo":"foo
> > stuff","bar":"bar stuff"}' />
> > >> >
> > >> > -Dale
> > >> >
> > >> >
> >
>
---------------------------------------------------------------------
> > >> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > >> > For additional commands, e-mail:
> > user-help@struts.apache.org
> > >> >
> > >> >
> > >> >
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
>
http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12393954
> > >> 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
> > >>
> > >>
> > >
> > >
> > > --
> > > "Hey you! Would you help me to carry the stone?"
> > Pink Floyd
> > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail:
> > user-help@struts.apache.org
> > >
> > >
> > >
> >
> > --
> > View this message in context:
> >
>
http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12395847
> > 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
> >
> >
>
>
>
---------------------------------------------------------------------
> 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
Re: Can anyone explain the leading "r" in OGNL list syntax?
Posted by Dave Newton <ne...@yahoo.com>.
I'd probably try asking this on a FreeMarker list
since the exception after removing the "r" came from
FreeMarker.
--- james_carbon5 <ja...@carbonfive.com> wrote:
>
> Thanks for the response Musachy. So, is the "r"
> shorthand to let freemarker
> know that my list is a LinkedHashMap? If not, what
> is the "r" doing?
>
> Thanks again,
> James
>
>
> Musachy Barroso wrote:
> >
> > Do it like:
> >
> > list="%{#@java.util.LinkedHashMap@{'Regular' :
> 'Regular', 'Decaf':
> > 'Decaf'}}"
> >
> > musachy
> >
> > On 8/29/07, james_carbon5 <ja...@carbonfive.com>
> wrote:
> >>
> >> Thanks for the response Dale. The "r" isn't a
> typo. If I remove it I get:
> >>
> >> javax.servlet.ServletException:
> freemarker.core.ParseException: Error on
> >> line ...
> >> Found string literal: "foo"
> >> Expecting: number
> >>
> >> etc...
> >>
> >> Thanks,
> >> James
> >>
> >>
> >> DNewfield wrote:
> >> >
> >> >
> >> > I've not written much freemarker, but I'd bet
> the r is a typo. The
> >> > important difference between the two tags you
> have are the single
> >> quotes
> >> > around the value of the list attribute.
> >> >
> >> > james_carbon5 wrote:
> >> >> <@s.select ... list=#{"foo":"foo
> stuff","bar":"bar stuff"} />
> >> >> <@s.select ... list=r'#{"foo":"foo
> stuff","bar":"bar stuff"}' />
> >> >
> >> > -Dale
> >> >
> >> >
>
---------------------------------------------------------------------
> >> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> >> > For additional commands, e-mail:
> user-help@struts.apache.org
> >> >
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
>
http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12393954
> >> 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
> >>
> >>
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?"
> Pink Floyd
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12395847
> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Can anyone explain the leading "r" in OGNL list syntax?
Posted by james_carbon5 <ja...@carbonfive.com>.
Thanks for the response Musachy. So, is the "r" shorthand to let freemarker
know that my list is a LinkedHashMap? If not, what is the "r" doing?
Thanks again,
James
Musachy Barroso wrote:
>
> Do it like:
>
> list="%{#@java.util.LinkedHashMap@{'Regular' : 'Regular', 'Decaf':
> 'Decaf'}}"
>
> musachy
>
> On 8/29/07, james_carbon5 <ja...@carbonfive.com> wrote:
>>
>> Thanks for the response Dale. The "r" isn't a typo. If I remove it I get:
>>
>> javax.servlet.ServletException: freemarker.core.ParseException: Error on
>> line ...
>> Found string literal: "foo"
>> Expecting: number
>>
>> etc...
>>
>> Thanks,
>> James
>>
>>
>> DNewfield wrote:
>> >
>> >
>> > I've not written much freemarker, but I'd bet the r is a typo. The
>> > important difference between the two tags you have are the single
>> quotes
>> > around the value of the list attribute.
>> >
>> > james_carbon5 wrote:
>> >> <@s.select ... list=#{"foo":"foo stuff","bar":"bar stuff"} />
>> >> <@s.select ... list=r'#{"foo":"foo stuff","bar":"bar stuff"}' />
>> >
>> > -Dale
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12393954
>> 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
>>
>>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12395847
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
Re: Can anyone explain the leading "r" in OGNL list syntax?
Posted by Musachy Barroso <mu...@gmail.com>.
Do it like:
list="%{#@java.util.LinkedHashMap@{'Regular' : 'Regular', 'Decaf': 'Decaf'}}"
musachy
On 8/29/07, james_carbon5 <ja...@carbonfive.com> wrote:
>
> Thanks for the response Dale. The "r" isn't a typo. If I remove it I get:
>
> javax.servlet.ServletException: freemarker.core.ParseException: Error on
> line ...
> Found string literal: "foo"
> Expecting: number
>
> etc...
>
> Thanks,
> James
>
>
> DNewfield wrote:
> >
> >
> > I've not written much freemarker, but I'd bet the r is a typo. The
> > important difference between the two tags you have are the single quotes
> > around the value of the list attribute.
> >
> > james_carbon5 wrote:
> >> <@s.select ... list=#{"foo":"foo stuff","bar":"bar stuff"} />
> >> <@s.select ... list=r'#{"foo":"foo stuff","bar":"bar stuff"}' />
> >
> > -Dale
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12393954
> 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
>
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Can anyone explain the leading "r" in OGNL list syntax?
Posted by james_carbon5 <ja...@carbonfive.com>.
Thanks for the response Dale. The "r" isn't a typo. If I remove it I get:
javax.servlet.ServletException: freemarker.core.ParseException: Error on
line ...
Found string literal: "foo"
Expecting: number
etc...
Thanks,
James
DNewfield wrote:
>
>
> I've not written much freemarker, but I'd bet the r is a typo. The
> important difference between the two tags you have are the single quotes
> around the value of the list attribute.
>
> james_carbon5 wrote:
>> <@s.select ... list=#{"foo":"foo stuff","bar":"bar stuff"} />
>> <@s.select ... list=r'#{"foo":"foo stuff","bar":"bar stuff"}' />
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Can-anyone-explain-the-leading-%22r%22-in-OGNL-list-syntax--tf4349553.html#a12393954
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
Re: Can anyone explain the leading "r" in OGNL list syntax?
Posted by Dale Newfield <Da...@Newfield.org>.
I've not written much freemarker, but I'd bet the r is a typo. The
important difference between the two tags you have are the single quotes
around the value of the list attribute.
james_carbon5 wrote:
> <@s.select ... list=#{"foo":"foo stuff","bar":"bar stuff"} />
> <@s.select ... list=r'#{"foo":"foo stuff","bar":"bar stuff"}' />
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org