--- On Tue, 7/22/08, Brian Daddino wrote:
> Instead of making my join in the query, I am just querying
> out my contacts and using 2 iterators...
> <s:iterator value="contacts" status="status">
>   <s:iterator value="contactmethodses" status="status">
>     <s:property value="firstName"/>
>     <s:property value="lastName"/>
>     <s:property value="method"/>
> ...
> 
> This works fairly well, but loses my outer join (if there
> is no contact method, the contact's name is not even displayed).
> Am I missing something still?

Most likely :)

First of all, you're iterating over two sets of things: contacts, and contact 
methods.

The iterator tag [1] works by pushing each object of iteration onto the top of 
the stack. The property tag [2] will call the getter on the object on the top 
of the stack (actually, I thought it'd keep going down the stack; I could be 
remembering incorrectly though).

You have two iterators; once you're inside the second iterator the contact is 
no longer on the top of the stack--the contact method is (if there *are* any 
contact methods). That can be solved by providing an "id" attribute, thus 
naming the object of iteration, and allowing you to refer to it regardless of 
stack depth. The pseudo-code I provided demonstrated this.

Second of all, your current implementation only displays properties if there 
are "contactmethodses" (your pluralizer needs help). The pseudo-code I provided 
printed the contact name *then* iterated over contactmethodses.

On a pedantic note, your outer join isn't being "lost", nor is data loading 
methodology relevant.

Dave

[1] Iterator tag: http://struts.apache.org/2.x/docs/iterator.html
[2] Property tag: http://struts.apache.org/2.x/docs/property.html


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

Reply via email to