Set the uid attribute in the display:table -tag like this:
<display:table uid="row" name="..." id="..." ...
after that you can refer to the row from struts tags by using #attr.row
so the iterator should now works like this:
<s:iterator value="#attr.row.roles">
On 8/8/07, fergunet <fergunet@hotmail.com> wrote:
>
>
> Hi all!
>
> I've created a display table to show a list of things and their
> attributes.
> But one of those attributes is another list of objects. I don't know how
> to
> print their names.
>
> Let's see what I have:
>
>
> <display:table name="usersBase" class="displaytag" pagesize="10"
> defaultsort="1"
> defaultorder="ascending" export="true" id="row"
> requestURI="/user/list.mpch" >
> <display:caption title="global.users"/>
> <display:column property="id" titleKey="global.id"
> sortable="true" headerClass="sortable"/>
> <display:column property="login" titleKey="global.login"
> sortable="true" headerClass="sortable"/>
> <display:column property="name" titleKey="global.name"
> sortable="true" headerClass="sortable"/>
> <display:column property="cif" titleKey="global.cif"
> sortable="true" headerClass="sortable"/>
> <display:column property="email" titleKey="global.email"
> sortable="true" headerClass="sortable"/>
> <display:column property="roles" titleKey="global.roles"
> sortable="true" headerClass="sortable"/>
>
> <display:column title="Roles">
> <s:iterator value="${row.roles}">
> ITERATE!!!!
> </s:iterator>
>
>
> </display:column>
> <display:column title="getTextglobal.provider" sortable="true"
> headerClass="sortable">
> <s:if test="${row.provider}==true">
> Is provider
> </s:if>
> <s:else>
> Is not provider
> </s:else>
> </display:table>
>
>
> Look at the "roles" property column. That property is a List<RoleVO> which
> have an attribute RoleBaseVO wich have the String "name". I'm trying to
> show
> the list of that names. (Now only prints:
> [org.myapp.common.isc.model.users.RoleVO@d53d82,
> org.myapp.common.isc.model.users.RoleVO@1b939d3,
> org.myapp.common.isc.model.users.RoleVO@1836525] )
>
> I thought to use an iterator as you can see, but the "ITERATE!!!" string
> is
> never shown.
>
> Any ideas? Thanks in advance, and sorry about my English.
> --
> View this message in context:
> http://www.nabble.com/How-to-list-a-property-in-a-display%3Atable-%28Struts-2%29-tf4236011.html#a12052184
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
|