Q
quickcur
Hi, All,
I think you all find this situation very often
Suppose you have database tables
People table
id, name, address, telephone
1, Smith, 1 street, 1234
2, Mick, 2 Ave, 2345
3, XX, 4 bld, 9877
Group table
peopleid, groupid, groupname
1, 111, "good people"
2, 111, "good people"
3, 222, "bad people"
Suppose you have to display a group with all people's name in a jsp
page. You can query the group table. But it has only people id, not
people name. We have to link them. To do this, we have different
optioins:
1. Creae a database view which links group, peopleid, people name
together. You query this view and display the page. But if you have
many tables, and use this case frequently, you have to create a lot of
views.
2. Query group table and people table and do some parsing in the jsp
page. It works but it makes the jsp page very complicated.
3. Write customer tag which query the people table. For example,
<c:forEach ...loop through all peopleid in the group>
<mytageoplename peopleid="1">
</c:forEach>
Inside the tag, I query the people table with the peopleid and write
out the name. The jsp page is clean, no views. But it involvs a lot of
database connection. i am not sure about the perfermance.
Any comments?
Thanks,
qq
I think you all find this situation very often
Suppose you have database tables
People table
id, name, address, telephone
1, Smith, 1 street, 1234
2, Mick, 2 Ave, 2345
3, XX, 4 bld, 9877
Group table
peopleid, groupid, groupname
1, 111, "good people"
2, 111, "good people"
3, 222, "bad people"
Suppose you have to display a group with all people's name in a jsp
page. You can query the group table. But it has only people id, not
people name. We have to link them. To do this, we have different
optioins:
1. Creae a database view which links group, peopleid, people name
together. You query this view and display the page. But if you have
many tables, and use this case frequently, you have to create a lot of
views.
2. Query group table and people table and do some parsing in the jsp
page. It works but it makes the jsp page very complicated.
3. Write customer tag which query the people table. For example,
<c:forEach ...loop through all peopleid in the group>
<mytageoplename peopleid="1">
</c:forEach>
Inside the tag, I query the people table with the peopleid and write
out the name. The jsp page is clean, no views. But it involvs a lot of
database connection. i am not sure about the perfermance.
Any comments?
Thanks,