I wrote a Java wrapper class to model the tree structure and to generate JavaScript code for Yahoo UI TreeView. You can download it from here. Also, there is a Java test client click here.
Please read throught the Yahoo UI documentation for all includes and basic understanding of Yahoo TreeView. You should prefix this javascript code into JSP since I havent gotton a chance to write any tag library which you can write anway..
\Mscript type="text/javascript>
var tree;
var nodes = new Array();
var nodeIndex;
function treeInit() {
buildTree();
}
function buildTree() {
tree = new YAHOO.widget.TreeView("treeDiv1");
root = tree.getRoot();
<%= treeRootNodeReference.generateTree("root")%>
tree.draw();
}