简体   繁体   English

在JSP页面中打印“树”结构

[英]Print a “tree” structure in JSP page

I'm trying to print out a "tree" structure in my JSP page that looks something like this: 我正在尝试在我的JSP页面中打印出一个“树”结构,看起来像这样:

Root
 |
 |----Dependencies
 |        |----A
 |        |----B
 |        |----C
 |
 |----Dependents
          |----D
          |----E

I'm hoping that someone around here knows of some utility that would help me do my job (it can use any technology, just as long as I can insert it in my JSP page). 我希望周围的人知道一些可以帮助我完成工作的实用程序(它可以使用任何技术,只要我可以在JSP页面中插入它)。 The Root and the other variables are all Strings (A, B, C etc...). Root和其他变量都是字符串(A,B,C等......)。

I'm planning on using something like this: (I haven't written this yet, so I'm not sure if it'll work...) 我打算使用这样的东西:(我还没写过,所以我不确定它是否会起作用......)

public class DependencyTree 
{ 
  private String root; 
  private ArrayList<String> dependencies, dependents; 
} 

Basically, root corresponds to "root" on my example above, and the two ArrayLists contain A, B, C and D, E respectively. 基本上,root对应于上面示例中的“root”,两个ArrayLists分别包含A,B,C和D,E。

If you don't mind using some javascript to render the tree in your JSP, jsTree is a jQuery component which supports JSON and XML data sources to populate a tree view: 如果您不介意使用某些javascript在JSP中呈现树,则jsTree是一个jQuery组件,它支持JSON和XML数据源来填充树视图:

http://ajaxian.com/archives/jstree-jquery-based-javascript-tree-component http://ajaxian.com/archives/jstree-jquery-based-javascript-tree-component

Edit : Here is some more specific information on getting started with the component: http://www.jstree.com/documentation/core 编辑 :以下是有关组件入门的更具体信息: http//www.jstree.com/documentation/core

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM