How about Struts nested tag library? If you want to use struts taglibs
only ...

Regards
Guru
 
------------------------------------------------------------------------
-----------
Gurumoorthy Raghupathy
Email  :  [EMAIL PROTECTED]
Internal Extn : 2337 
External Phone  : 01483712337 
Nielsen Book
3rd Floor Midas House
62 Goldsworth Road
Woking Surrey GU21 6LQ
Visit us at  : http://www.nielsenbookdata.co.uk/ 
------------------------------------------------------------------------
-----------

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
Sent: 12 March 2007 10:33
To: user@struts.apache.org
Subject: Re: Print property of a property using bean:write?

David Alves wrote:
> Hi all,
> 
> I have a User object which has a Country object attached to it, 
> representing the country that the user is from. If I do
> 
> <bean:write name="user" property="country" />
> 
> then I get the output of Country.toString(). However, say I want to
call 
> one of the other methods in country, like population. Is there an 
> elegant way to do this? Something like
> 
> <bean:write name="user" property="country.population" />
> 
> where it would be translated behind-the-scenes into 
> user.getCountry().getPopulation() If there's a way to do this with 
> Struts Beans or if there's another tag library that would do it, I'd 
> appreciate it if you could point me in the right direction. I want to 
> avoid the use of <% %> if possible. Thanks for your time!

Without thinking about it very much, I would expect that one or other of

these would work:

   <bean:write name="user" property="country.population" />
   <bean:write name="user.country" property="population" />

but failing that, JSTL would probably be the better choice:

   ${user.country.population}

No muss, no fuss. If you aren't familiar with JSTL, take an hour to 
learn it.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to