It's not the syntax that's an issue, it's how you're implementing your data transfer.
There's no "syntax" for retrieving a persisted object by ID beyond what OGNL's expression language (EL) provides. You can call arbitrary methods. The problem with doing that on the view layer on a row basis is that you end up putting a lot of data retrieval logic into your template, where (a) it doesn't belong, and (b) it's on a row-by-row basis which will kill any hopes of reasonable performance at scale. You should be loading your data on the Java side. If you're talking about on-demand, Ajax-y data loading then it's done via a standard Ajax call and you can pass IDs or whatever else you want to the server side. Dave On Thu, May 1, 2014 at 2:59 PM, Antonio Sánchez <ads...@gmail.com> wrote: > Yes, that the obvious way. Thank you. > > But guess there is some situation where the view needs asking to the > controller for some data passing some parameter. Although the example is > not the best one, suppose PersonAction has Map<String, String> get > Countries(), which is called in prepare(). Is there any syntax for > retrieving the country name corresponding to the country id in each > iteration? > > > El jue 01 may 2014 17:35:52 CEST, Dave Newton escribió: > > If you only have an ID then you need to join the Country model; this seems >> obvious. >> >> You should do all that on the Java side to avoid the N+1 issue. >> >> Dave >> >> >> >> On Thu, May 1, 2014 at 10:58 AM, Antonio Sánchez <ads...@gmail.com> >> wrote: >> >> Hello. >>> >>> Person CRUD. >>> >>> Person bean has name, age... and "countryId". Country bean has countryId >>> and countryName. >>> >>> In persons.jsp all persons are listed, displaying rows for each person, >>> and columns for name, age... but countryName must be displayed instead of >>> countryId: >>> >>> <s:iterator value="persons"> >>> >>> I can display countryId: >>> >>> <td><s:property value="countryId"/></td> >>> >>> But, how can I display countryName? >>> >>> Thanks. >>> >>> >>> >>> >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >>> >> >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- e: davelnew...@gmail.com m: 908-380-8699 s: davelnewton_skype t: @dave_newton <https://twitter.com/dave_newton> b: Bucky Bits <http://buckybits.blogspot.com/> g: davelnewton <https://github.com/davelnewton> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>