Ok basically I want to do something really simple but I'm not exactly sure
how to do it with tag libraries.  I have three tables: name, address, phone.
Each name can have multiple addresses, and each address can have multiple
phones.  So using plain old jsp it would look something like:

rs1 = "select * from names";
while (rs1.next()) {
    rs2 = "select * from addresses where name_id = names.id";
    while(rs2.next()) {
          rs3 = "select * from phone where address_id = addresses.id";
          while (rs3.next()) {
          }
    }
}

So that the output would look something like:

Matt Hughes
    Address 1
        Phone 1
        Phone 2
    Address 2
etc...etc...

Yeah, it's really very pseudocode, but I think it's understandable.  So I've
created three generic tags: connection, resultset, and column.  How do I
recreate those kinds of nested while loops using tags.  I almost want to put
the beginning of the while loop in the doStartTag and the end bracket in the
doEndTag...if only it were that easy.  Any suggestions on how I could make
the tags work to something like below:

<Connection id="conn1">
   <resultset conn="conn1" id="rs1">
       <column rs="rs1">first_name</column>
       <resultset conn="conn1" id="rs2">
           <column rs="rs2">address_1</column>
           <resultset conn="conn1" id="rs3">
                <column rs="rs3">phone_1</column>
           </resultset>
        </resultset>
    </resultset>
</connection>


The other problem I'm having with this is how to pass the field_id from the
second table into the third tag.  Ideally it should look something like:

...
                <resultset conn="conn1" id="rs3" QueryParameter="<resultset
conn="conn1" id="rs2">field_id</resultset>
                        <column rs="rs3">contact name</column>
                </resultset>

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of 
Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, 
proprietary copyrighted and/or legally privileged, and is intended solely for the use 
of the individual or entity named on this message. If you are not the intended 
recipient, and have received this message in error, please immediately return this by 
e-mail and then delete it.

==============================================================================


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

Reply via email to