aspose file tools*
The moose likes JSP and the fly likes how to create a tree structure in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to create a tree structure in jsp" Watch "how to create a tree structure in jsp" New topic
Author

how to create a tree structure in jsp

meera jan
Greenhorn

Joined: Aug 30, 2005
Posts: 21
hi all,
Can i be able to create a tree structure in jsp.I mean.Parent node and child nodes.Expanding the parent displays the childs,and also be able collapse it..Data is loaded from database.Any idea?pls help me..thanks
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

The jsp for this should be pretty straight forward and would involve getting the right data avilable to the page. The expanding and collapsing effect (the tree part) on the browser is achieved using javascript and you would need more than a superficial knowledge of javascript to code it. Recommend that you go through this taglib and adapt it for your needs.

ram.
meera jan
Greenhorn

Joined: Aug 30, 2005
Posts: 21
hi,
in the sample ,they are using one tld named taglib.tld
.From where i will get it?should i download something?
Nupur Khanna
Greenhorn

Joined: May 18, 2006
Posts: 4
Hi
You can achieve this functionality using XML.
Load your data into an XML, whose structure you will have to define according to your database table design.
Next, you can use XSL to render the XML onto a jsp page.
The xml file can be set as the src of a frame and u wl be able to see the functioanlity u desire.
The toggle effect can be got by the following javascript code:
function showBranch(branch){
//alert("branch opened with id value : " + document.getElementById(branch).cname);

var objBranch = document.getElementById(branch).style;
if(objBranch.display=="block")
objBranch.display="none";
else
objBranch.display="block";
swapFolder('I' + branch);

}

function swapFolder(img){
objImg = document.getElementById(img);
if(objImg.src.indexOf('images/closed.gif')>-1)
objImg.src = openImg.src;
else
objImg.src = closedImg.src;
}
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

Originally posted by meera jan:
hi,
in the sample ,they are using one tld named taglib.tld
.From where i will get it?should i download something?


You will have to download the jar that contains the taglib classes and place them in your application's WEB-INF/lib directory.

ram.
naresh kumar singarapu
Greenhorn

Joined: Feb 15, 2011
Posts: 2
Hi Nupur Khanna

Can you please provide an example or url demonstrating the procedure you have explained.
Thanks in advance
P Arunkumar
Ranch Hand

Joined: Jan 05, 2012
Posts: 119
Hi

I need a Jsp Code to generate tree Structure. it no need to connect to database just while running time it want to show some data in tree structure



Thanks in advance. please help me as soon as possible.
Mahefuz Satarmaker
Greenhorn

Joined: Jan 06, 2012
Posts: 1
Hello Jenifer,
You can use the jquery tree structure to make a tree structure in your jsp page.
Following url can help you up Jquery tree.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Jenifer Rajkumar wrote:Thanks in advance. please help me as soon as possible.

Please EaseUp.

And welcome to the Ranch to both of you!


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: how to create a tree structure in jsp