It seems that it was a syntax error coupled with a lack of some struts
fundamentals that lead me down this road. I had the following:
        <logic:iterate id="aAuthor" name="aBook" property="authorIds"/>
                <bean:write name="aAuthor"/><br>
        </logic:iterate>
Note the '/' on the logic:iterate tag. When this present only the last
element in my List would display. I knew it had to be something dumb.
Thanks all for your help on this.

steve

-----Original Message-----
From: Steve [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 16, 2002 6:04 PM
To: [EMAIL PROTECTED]
Subject: RE: Multiple <logic:iterate> still unclear


I tried adding the length attribute:

<logic:iterate  id="aBook" name="allBooks">
     <bean:write name="aBook" property="id"/><br>
     <bean:write name="aBook" property="desc"/><br>
     <logic:iterate id="aAuthor" name="aBook" property="authorIds"
length="6">
        <bean:write name="aAuthor"/><br>
     </logic:iterate>
 </logic:iterate>

This displays the 6th element in the List. I have tried many variations
of this and yet still can not seem to iterate over and display the
contents of the List object. I have verified that the List is populated.
I know the answer is going to be so simple, I just can not see it right
now. Anyone know what the correct syntax should be? 

-----Original Message-----
From: Brian Hickey [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 16, 2002 12:39 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Multiple <logic:iterate> still unclear


Steve,

There is a "length" attribute on the logic:iterate tag. You can set it
as a hard value or, in the case of your bean containing a list, get the
size(), set a page scoped var and do portions of the iteration.

B

----- Original Message -----
From: "Steve" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 16, 2002 12:25 PM
Subject: RE: Multiple <logic:iterate> still unclear


> Thanks that helped with the inner interate count. However it is only
> displaying the last item in the List:
>
> <logic:iterate  id="aBook" name="allBooks">
>     <bean:write name="aBook" property="id"/><br>
>     <bean:write name="aBook" property="desc"/><br>
>     <logic:iterate id="aAuthor" name="aBook" property="authorIds">
>        <bean:write name="aAuthor"/><br>
>     </logic:iterate>
> </logic:iterate>
>
> Displays:
> 1
> Book 1 desc
> 40
>
> Instead of:
> 1
> Book 1 desc
> 10
> 20
> 30
> 40
>
> Sorry if this is something obvious that I am missing.
>
> steve
>
> -----Original Message-----
> From: Victor CHEVALIER [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 16, 2002 9:02 AM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: RE: Multiple <logic:iterate> still unclear
>
>
> I think you should write in the second iterate :
>
> <logic:iterate id="aAuthor" name="aBook" property="authorIds">
>
> this means you iterate through the authors of aBook.
>
> -----Message d'origine-----
> De : Steve [mailto:[EMAIL PROTECTED]]
> Envoye : lundi 16 septembre 2002 14:53
> A : [EMAIL PROTECTED]
> Objet : Multiple <logic:iterate> still unclear
>
>
> I am still unclear as to how to use multiple <logic:iterate> tags. Can

> anyone shed some light on this for me. I currently have the following
> in my .jsp:
>
> <logic:iterate  id="aBook" name="allBooks">
>     <bean:write name="aBook" property="id"/><br>
>     <bean:write name="aBook" property="desc"/><br>
>     <logic:iterate id="aAuthor" name="allAuthors">
>        <bean:write name="aAuthor" property="authorIds"/><br>
>     </logic:iterate>
> </logic:iterate>
>
> allBooks is a collection of Book beans. The Book bean has the
> appropriate getters and setters, where the getAuthorIds returns a 
> List. With the current markup my output is this:
>
> 1
> Book 1 desc
> [10, 20, 30, 40]
> [10, 20, 30, 40]
> [10, 20, 30, 40]
> [10, 20, 30, 40]
>
> I am currently working with just 4 books, so it would seem that the
> nested <logic:iterate> is iterating over the number of books as 
> opposed to the number of elements in the authorIds List. I have 
> searched the archives and still can not seem to get this straight. I 
> simply want to
> display:
>
> 1
> Book 1 desc
> 10
> 20
> 30
> 40
>
> What should my syntax for the inner <logic:iterate> resemble? Or am I
> doing something else fundamentally wrong?
>
> Tia.
>
> steve
>
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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



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



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

Reply via email to