Miren Urkijo wrote:
> Hello
> i am new into this list and using displytag.
> i have one great problem.
>
> public class CatalogoCimasForm extends ActionForm {
>      private Float utmy;
>      private Float utmx;
>      private String monte;
>     private ArrayList Personas
> ...
> set/get methods
>
> other class
> public class Person {
> private String nombre
> private String edad
> ...
> set/get methods
>
> I have one struts application that returns one ArrayList with
> CatalogoCimasForm objects.
> into each CatalagoCimasForm object can be other ArrayList with Person
> Objects.
> So, i have one arraylist of obect ant into each object other arraylist
> with
> objects.
>
> The fist level, the CatalagoCimasForm i paint into the webpage well whit
> this:
> <%
> List miArray = (ArrayList)request.getAttribute("miArray");
> request.setAttribute("miArray",miArray);
> %>

First, this whole bit is unnecessary.  You're taking the list that's
stored as "miArray" and... storing it as "miArray".  If it's already
there, you don't need to RE-store it.  No real harm, but it's unnecessary.

> <display:table requestURI="ListadoCimas.do" name="miArray" id="lista"
> export="true" sort="list" pagesize="20">

I'd also recommend changing the "id" to "uid".  In some environments, the
"id" attribute can cause trouble.

> but now i want to paint other columns with the arraylist of persons
> information, only the nombre property.
> how can i made it?

Well, it depends.  I'm not quite certain how you want to display it.  So
each of your rows contains information about one CatalagoCimasForm.  And
each form contains multiple Person objects and you want to display the
nombre property for each of the Person objects.  If that's what you want
to do, then it's fairly straightforward: iterate the list of Person
objects and reference the nomber properties.  So that would look something
like this:

<display:column title="Nombres">
   <c:forEach items="${lista.personas}" var="person">
      <c:out value="${person.nombre}"/><br>
   </c:forEach>
</display:column>

This takes the current row object (the name is specified as "lista" by the
"id" or "uid" attribute in the <display:table> tag) and gets the personas
list (through the getPersonas() getter) and iterates that list.  The
current item is referred to as "person" and you can then reference the
properties of that object.  Display the person.nomber and--voila--you have
your nombre property displayed.

If you want it displayed somehow differently, this is still probably the
direction you need.

> Sorry for my bad english

It's OK, I know native English speakers who are almost incomprehensible :)

-- 
Rick Herrick
[EMAIL PROTECTED]

Proud member of the reality-based community

Never try to discourage thinking for you are sure to succeed.--Bertrand
Russell

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to