Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
409 views
in Technique[技术] by (71.8m points)

javascript - 使用纯JavaScript的JSP树视图显示(JSP tree view display with plain javascript)

I have to display JSP in a tree view.

(我必须在树视图中显示JSP。)

I have 2 tables folder and pages.

(我有2个表格的文件夹和页面。)

Folder structure is as below.

(文件夹结构如下。)

The main page has option to create only folder.

(主页上有创建仅文件夹的选项。)

Inside folders pages can be added.

(可以添加内部文件夹页面。)

So 1st folderwill have parent is 0, child id 1. 2nd folder will have child id 2, parent id 0 in case its outside in the root.

(因此,第一个文件夹的父代号为0,子代号为1。第二个文件夹的子代号为2,父代号为0,以防外部在根目录中。)

When you create subfolder inside folder 1 then this would have child id =3 and parent id=1 and so on as below table.

(当您在文件夹1中创建子文件夹时,子文件夹ID = 3,父文件夹ID = 1,依此类推,如下表所示。)

The pages tables will hold user id, child id(which maps to child id in folder table ) and page name

(页面表将包含用户ID,子ID(映射到文件夹表中的子ID)和页面名称)

在此处输入图片说明

UserId  parentId ChildId Folder
1       0       2358    folder1
1       0       2360    folder2
1       0       2361    folder3
1       2361    2362    subFolder3-1
1       2361    2363    subFolder3-2
1       2358    2364    subFolder1

I want a clean way to dispaly this in the JSP page.

(我想要一种干净的方法在JSP页面中显示此内容。)

How do i loop to get the tree structure.

(我如何循环获取树形结构。)

My query just brings the folder list with parent and child id userid and folder name.

(我的查询只带了带有父子ID用户ID和文件夹名称的文件夹列表。)

how to iterate the list and display the tree structure.

(如何迭代列表并显示树结构。)

I have to show folder1 and when clicked whould expand and show the files/folders inside folder1 and so on.

(我必须显示folder1并单击,然后展开并显示folder1内的文件/文件夹,依此类推。)

I see jQuery treetable to expand collapse the tree however dont see a way to display them in JSP.

(我看到jQuery树表可以展开以折叠树,但是看不到在JSP中显示它们的方法。)

Mine is a pure JSP,Javascript, Servlet app.

(我的是一个纯JSP,Javascript,Servlet应用程序。)

Please suggest an effectve way to display the DB data in JSP and navigate the tree.

(请提出一种有效的方法来在JSP中显示数据库数据并导航树。)

Thank you.

(谢谢。)

from table 2358, 2360, 2361 are th root folders.

(表2358、2360、2361中的根文件夹。)

2362, 2363(SubFolders) is inside 2361 and 2368(subFolder) inside 2364.

(2362、2363(子文件夹)位于2361内部,2368(子文件夹)位于2364内部。)

  ask by JNPW translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...