You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Joe Hertz <jh...@patriot.net> on 2003/12/08 01:56:08 UTC
Maps within Beans (was Stupid Bean Tricks)
This example relates how to _implement_ things in your own taglibs. It
doesn't mention Maps at all (the part I'm being befuddled by). It's not
even specific to struts.
Actually, all I need is a reference on usage of the struts taglibs
beyond the foo.bar.baz example. I want to see how one can refer to Maps
contained in beans like Martin explained:
<bean:message name="user" property="en.message"/>
I have to admit, I found this confusing also because in my User object
(session key as "user") there would be a map of UserData objects. The
above example doesn't mention userdata at all, so I'm guessing Martin
meant this:
<bean:message name="user" property="en.UserData.message"/>
But in the interest of saving bandwidth, just the reference on how to
get to maps within beans.
> -----Original Message-----
> From: Martin Gainty [mailto:mgainty@hotmail.com]
> Sent: Sunday, December 07, 2003 10:59 PM
> To: Struts Users Mailing List; jhertz@patriot.net
> Subject: Re: Stupid Bean tricks
>
>
> a complete example on how to use this concept is located at
> http://www.orionserver.com/tutorials/taglibs/8.html
> viel Glueck,
> Martin
> ----- Original Message -----
> From: "Joe Hertz" <jh...@patriot.net>
> To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
> Sent: Sunday, December 07, 2003 5:58 PM
> Subject: RE: Stupid Bean tricks
>
>
> > Martin-
> >
> > Can you point me to the correct docs for how this works? I
> don't find
> > anything regarding using maps within beans this way.
> >
> > Tx
> >
> > > -----Original Message-----
> > > From: news [mailto:news@sea.gmane.org] On Behalf Of Martin Cooper
> > > Sent: Friday, December 05, 2003 3:58 PM
> > > To: struts-user@jakarta.apache.org
> > > Subject: Re: Stupid Bean tricks
> > >
> > >
> > > Assuming your User object is stored in the request under the
> > > key "user", the language you want is "en" (English), and the
> > > UserData property you want is "message", you would do:
> > >
> > > <bean:message name="user" property="en.message"/>
> > >
> > > --
> > > Martin Cooper
> > >
> > >
> > > "Joe Hertz" <jh...@patriot.net> wrote in message
> > > news:F70CBA8E10F7414BBEC18D902FBCA6D603CF45@napalm.drachenschl
> > > oss.local...
> > > > I considered that, but (and I'm an utter newbie so I apologize
> > > > here)
> > > >
> > > > How would I refer to an element of UserData in a <bean:message>
> > > > tag?
> > > >
> > > > > -----Original Message-----
> > > > > From: news [mailto:news@sea.gmane.org] On Behalf Of Martin
> > > > > Cooper
> > > > > Sent: Friday, December 05, 2003 12:32 PM
> > > > > To: struts-user@jakarta.apache.org
> > > > > Subject: Re: Stupid Bean tricks
> > > > >
> > > > >
> > > > > Why not convert your Set into a Map keyed by language /
> > > locale? Then
> > > > > get(locale) is effectively provided for you.
> > > > >
> > > > > --
> > > > > Martin Cooper
> > > > >
> > > > >
> > > > > "Joe Hertz" <jh...@patriot.net> wrote in message
> > > > > news:F70CBA8E10F7414BBEC18D902FBCA6D603CF40@napalm.drachenschl
> > > > oss.local...
> > > > > Probably a very basic question, and infinitely dealable....I
> > > > > hope.
> > > > >
> > > > > I have a User object, which itself contains a Set of UserData
> > > > > objects (the UserData is stuff that needs to be
> > > multilingual. Each
> > > > > instance has the part of the user's data that would vary when
> > > > > presented in each
> > > >
> > > > > language).
> > > > >
> > > > > So, in my JSP, how do I get to a specific instance of
> UserData?
> > > > > I
> > > > > can write a getter than could take a locale or even just
> > > a language
> > > > > code, but since it's not a numeric, the taglib chokes on
> > > it, or at
> > > > > least it appears to
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> --------------------------------------------------------------------
> > > -
> > > > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > > > struts-user-help@jakarta.apache.org
> > >
> > >
> > >
> > >
> > >
> --------------------------------------------------------------------
> > > -
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> > >
> > >
> > >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org