Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

TreeView in JSP ?

Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I need to display dynamic data as tree view using JSP page.
Is there any tags in jsp to display treeview or anyother choice.

Data should access from Database dynamically not static data

if any please help me in this.

thank you all.
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are familiar with javascript objects, you can create a tree kind structure using javascripts and you can display on the screen, this is advance option if you want the tree leaves to be expanded and some action needs to happen.check this URL( )

Else If you just want to display the tree without providing and action to the tree you can use something like this.

The table would have a structure similar to the following:

col 1col 2col 3col 4
col 1.0   
 buttoncol 2.0  
  buttoncol 3.0 
   buttoncol 4.0
col 1.1   
 buttoncol 2.1  
col 1.2   
 buttoncol 2.2  
 button col 3.2 

A reasonably simple Map based data structute should be sufficient to help stored the data model while the table is generated. When generating the HTML, if you turn off all the cell borders then you'll have something that looks much like a tree. If you add little buttons to the cells as indicated by 'button' and write some code behind them then you can use them to collapse/expand individual nodes in the tree. This collapsing/expanding could be done client side (using JavaScritpt and DIV elements wrapping the cells to hide/display) or server side (re-generate the table for that request with certain rows included/excluded).
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic