Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Navigation tree in jsp

 
mehul thakor
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prerequisite:
Basic knowledge of JSP

Navigable Tree (With Expand and Collapse features):
Features: Each node can be expanded and collapsed. Expand all and Collapse all options are also available. Sample JSP provided in Zip (tree.jsp) displays the contents of the directory in Tree Structure view. Code in JSP can be modified to use DOM object to display similar Tree Structure view from XML files or database.


--------------------------------------------------------------------------------

Sample :-

Expand all Collapse all
c:\root folder
c:\root folder\First Child
c:\root folder\First Child\Child 1_1
End node 1_1_1.txt Size: 0 KB Modified: 10.05.04 05:43:16
End node 1_1_2.txt Size: 0 KB Modified: 10.05.04 05:43:16
c:\root folder\First Child\Child 1_2
c:\root folder\First Child\Child 1_2\Child 1_2_1
c:\root folder\First Child\Child 1_2\Child 1_2_1\Child 1_2_1_1
abc.txt Size: 0 KB Modified: 10.05.04 05:46:04
abc2.txt Size: 0 KB Modified: 10.05.04 05:46:04
abc3.txt Size: 0 KB Modified: 10.05.04 05:46:04
c:\root folder\First Child\Child 1_2\Child 1_2_1\Child 1_2_1_2
abc2.txt Size: 0 KB Modified: 10.05.04 05:46:04
abc3.txt Size: 0 KB Modified: 10.05.04 05:46:04
End node 1_2_1_1.txt Size: 0 KB Modified: 10.05.04 05:43:16
End node 1_2_1_2.txt Size: 0 KB Modified: 10.05.04 05:43:16
End node 1_2_1_3.txt Size: 0 KB Modified: 10.05.04 05:43:16
c:\root folder\Second Child
abc.txt Size: 0 KB Modified: 10.05.04 05:46:04
abc2.txt Size: 0 KB Modified: 10.05.04 05:46:04
abc3.txt Size: 0 KB Modified: 10.05.04 05:46:04
c:\root folder\Third Child
abc.txt Size: 0 KB Modified: 10.05.04 05:46:04
abc2.txt Size: 0 KB Modified: 10.05.04 05:46:04
abc3.txt Size: 0 KB Modified: 10.05.04 05:46:04


--------------------------------------------------------------------------------
An Object similar to CustomNode should be created with following properties.

--------------------------------------------------------------------------------
CustomeNode.java
--------------------------------------------------------------------------------



Indented data display (Static Tree Structure):
Display hierarchal data in a tree view. Data is indented based on the level of hierarchy. In the following sample hierarchal data display, tab numbers are displayed in first row and level of hierarchy is displayed in first column.


--------------------------------------------------------------------------------

Sample :-

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Root
1 Directory: c:\root folder
2 Directory: c:\root folder\First Child
3 Directory: c:\root folder\First Child\Child 1_1
4 End node 1_1_1.txt Size: 0 KB Modified: 10.05.04 05:43:16
4 End node 1_1_2.txt Size: 0 KB Modified: 10.05.04 05:43:16
3 Directory: c:\root folder\First Child\Child 1_2
4 Directory: c:\root folder\First Child\Child 1_2\Child 1_2_1
5 Directory: c:\root folder\First Child\Child 1_2\Child 1_2_1\Child 1_2_1_1
6 abc.txt Size: 0 KB Modified: 10.05.04 05:46:04
6 abc2.txt Size: 0 KB Modified: 10.05.04 05:46:04
6 abc3.txt Size: 0 KB Modified: 10.05.04 05:46:04
5 Directory: c:\root folder\First Child\Child 1_2\Child 1_2_1\Child 1_2_1_2
6 abc2.txt Size: 0 KB Modified: 10.05.04 05:46:04
6 abc3.txt Size: 0 KB Modified: 10.05.04 05:46:04
5 End node 1_2_1_1.txt Size: 0 KB Modified: 10.05.04 05:43:16
5 End node 1_2_1_2.txt Size: 0 KB Modified: 10.05.04 05:43:16
5 End node 1_2_1_3.txt Size: 0 KB Modified: 10.05.04 05:43:16
2 Directory: c:\root folder\Second Child
3 abc.txt Size: 0 KB Modified: 10.05.04 05:46:04
3 abc2.txt Size: 0 KB Modified: 10.05.04 05:46:04
3 abc3.txt Size: 0 KB Modified: 10.05.04 05:46:04


--------------------------------------------------------------------------------
Click Here to download the code with sample output for indented hierarchal data display. [TreeIndented.zip]

Contents of TreeIndented.zip:
JSP:
tree-indented.jsp
Sample output:
tree-indented_jsp_sample_output.html
Sample output - tree-indented_sample_output_without_border.html
Images:
plus.gif
minus.gif
folder.gif
folder_open.gif
layout.gif


--------------------------------------------------------------------------------
Click Here to download the code with sample output for Dynamic Navigable Tree. [DynamicTreeCode.zip]

Contents of DynamicTreeCode.zip:
JSP:
Tree.jsp
Sample output:
tree_jsp_sample_output.html
Images:
plus.gif
minus.gif
folder.gif
folder_open.gif
layout.gif
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mehul thakor,
Do you have a question?

It looks like you've simply copied and pasted a homework assignment into JavaRanch.

Why?
 
Agustina Martinez
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How can I download the zips with the samples? Doesn't look to have any link there.

Thanks,
Agustina
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There aren't any. This is just someone's old homework assignment.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!