You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Wes Wannemacher <we...@wantii.com> on 2009/07/30 15:36:25 UTC

OGNL and parameter binding

I am working on a new result-type and I want to put a field on the
result like this -

List<Map<String,String>> blah...

I looked a bit at the HttpHeadersResult because it has an incoming
HashMap<String,String> as one of the fields and you can set it via
OGNL using <param name="header.a">blah</param> and 'a' becomes the key
and 'blah' becomes the value. It seems like OGNL finds a method called
addHeader(String,String) to do it... Is there a way to do the same
sort of thing, but to push the map data into a list? If memory serves,
collections have to be instantiated, and that seems to be my stopping
point. I know I read about this somewhere, but I can't find it, and
ognl.org has disappeared from the 'net.

BTW, I'm using xwork 2.1.4, but will upgrade if Musachy's recent
changes can help me.

-Wes

-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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


Re: OGNL and parameter binding

Posted by Musachy Barroso <mu...@gmail.com>.
did you try something like:

<param name="mylist">${#{'key': 'value'}}</param>

OGNL docs: http://www.opensymphony.com/ognl/html/LanguageGuide/index.html

musachy

On Thu, Jul 30, 2009 at 6:36 AM, Wes Wannemacher<we...@wantii.com> wrote:
> I am working on a new result-type and I want to put a field on the
> result like this -
>
> List<Map<String,String>> blah...
>
> I looked a bit at the HttpHeadersResult because it has an incoming
> HashMap<String,String> as one of the fields and you can set it via
> OGNL using <param name="header.a">blah</param> and 'a' becomes the key
> and 'blah' becomes the value. It seems like OGNL finds a method called
> addHeader(String,String) to do it... Is there a way to do the same
> sort of thing, but to push the map data into a list? If memory serves,
> collections have to be instantiated, and that seems to be my stopping
> point. I know I read about this somewhere, but I can't find it, and
> ognl.org has disappeared from the 'net.
>
> BTW, I'm using xwork 2.1.4, but will upgrade if Musachy's recent
> changes can help me.
>
> -Wes
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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