Frank,
This is a fairly standard tree problem (if I understand you correctly) -
whereby 1 post has many children (replies) and each reply again has many
children etc.
In each post EJB write a method getChildren() which finds all replies with
the parent as the current post. (eg toppost.getChildren()) and returns a
collection of replies. You can then loop through the replies and get their
children etc. IF this is done recursively you can build the tree dynamically
for display.
Also you do not need a flag as to whether it has any children. Simply write
a method like :
public boolean hasChildren() {
return (getChildren().size() != 0)
}
Also useful might be a depth method (so you know how much to indent replies
etc):
public int getDepth() {
if (parent == null) return 0;
return parent.getDepth() + 1;
}
Hope this helps, let me know if you have any more problems.
Mike
__
| | Director - The BookmarkBox P/L
| | http://www.bookmarkbox.com <http://www.bookmarkbox.com/>
|/\| Manage and share your bookmarks online!
Do you enjoy our service? Why not tell your friends about us?
http://www.bookmarkbox.com/email.cfm
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Frank Apap
> Sent: Tuesday, 4 January 2000 8:34
> To: Orion-Interest
> Cc: Orion
> Subject: Beginners JSP/EJB problem
>
>
> Hi I am trying to work on a message board jsp/ejb web
> application. I have
> it all working (kinda) except displaying the threads. Each
> message has its
> own distinct msg id, as well as the id of its parent, and a flag set if it
> has any children.
>
> My problem seems to be how to iterate through each message using
> the jsp to
> properly display all the messages.
>
> If anyone has any ideas or tips for me I would appreciate it.
>
> Thank you
>
> Frank Apap
>
>