Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Print property of a property using bean:write?

David Alves

2007-03-12

Replies:

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!

Regards,
David Alves

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.