I have a tree like structure in database.
I have a query that returns my records sorted just the way I want them displayed.
SELECT branch_id, branch_name, parent_branch_id, level FROM dw_branches
start WITH parent_branch_id IS NULL
connect BY PRIOR branch_id = parent_branch_id
Which returns something like this
| branch_id | branch_name | parent_branch_id | level|
| 1 | one | | 1|
| 2 | two | 1 | 2|
| 3 | three | 1 | 2|
| 4 | four | 2 | 3|
| 5 | five | 1 | 2|
| 6 | six | 5 | 3|
In Java, I have a Branch object which has all these parameters (id, name, parent_id, level).
I want to do an output in JSP which would end up looking like this:
<ul>
<li>one
<ul>
<li>two
<ul>
<li>four</li>
</ul>
</li>
<li>three</li>
<li>five
<ul>
<li>six</li>
</ul>
</li>
</ul>
</li>
</ul>
Basically, I want to nest ul/li in order to display data using http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
Any suggestions on how to do so?