How to use Tree taglib with Struts
This code demonstrates a usage Tree taglib with Struts or similar packages. The main idea here that you can actually create the whole tree in your server side code and pass this tree to your presentation level as an attribute for the request. So it is the same way you are passing data from your controller to JSP files.
1. Your action creates a tree and saves it in the request scope:
com.cj.tree.TreeBean root=new com.cj.tree.TreeBean();
com.cj.tree.TreeBean node1=new com.cj.tree.TreeBean();
// now we can pass our tree to JSP
in your JSP file you can use tree taglib so (see modelName parameter):
<tree:createTree defaultConnectors="false" verticalConnector="vertical.gif" middleConnector="middle.gif" modelName="tree">
© Coldbeans Comments?
See also Other tips from Coldbeans.