You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Craig R. McClanahan" <cr...@apache.org> on 2002/08/02 19:58:08 UTC

Re: Using a Map like a bean?


On Fri, 9 Nov 2001, Daniel Aborg wrote:

> Date: Fri, 09 Nov 2001 13:46:13 +0000
> From: Daniel Aborg <da...@netengines.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Using a Map like a bean?
>
> Hello!
>
> I'm working on a project which we're developing using struts 1.0, and
> have just ran into a problem. Our business logic is using both Maps and
> beans to represent the data, and I can't find a way to access Map
> properties in struts.
>
> I've been looking at the documentation, googled around a bit and scanned
> the mail archives of struts-user. I came up with two things: 1) There
> might have been an implementation later than 1.0 of string indexed bean
> properties, though this isn't what I want. 2) The functionality I want
> seems to be wanted by other people as well but isn't implemented.
>
> What I'm looking for is some intuitive way to mix beans and Maps,
> something like this:
>
> <bean:write name="map" property="{key}"/>
>
> Which gets "key" from the Map stored in the attribute "map".
>
> And, to take it further, something like this:
>
> <bean:write name="bean" property="map{key}"/>
>
> <bean:write name="bean" property="map{key}.bean2.bean3.map2{key2}"/>
>

If you use parentheses instead of braces, these latter two examples will
work fine in latest nightly builds of Struts 1.1.

Craig



> Etc. This seems pretty intuitive to me.
>
> Is there any implementation of something like this in later versions of
> struts? Any stand-alone taglibs which implement it? Anything which might
> be of help in finding an implementation which deals with this? I'd
> rather avoid having to write the tags myself, as I'm under time
> constraints, oh joy.
>
> Thanks for your help!
>
> /Daniel
>
> --
> Daniel Aborg - Developer  <da...@netengines.com>
> M: +44 (0)7720 29 44 40  DDI: +44 (0)20 7451 1447
> Netengines: +44 (0)20 7451 1444  <www.netengines.com>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>