Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Generating Tree in Java code and to be used in JSP page

 
Ranch Hand
Posts: 44
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello;

I need to use Tree in my JSP page, by the way: I am using Spring MVC.
Is it possible to generate this tree in Java Code and to be sent for the JSP page to be used?
I am looking for this because I am not able to find good javascript tree which is free. Excep jsTree, but I need other than jsTree.

Regards
Bilal
 
Marshal
Posts: 25436
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can certainly generate a tree in Java code, but the tree you generate, you will want it to be a JavaScript tree. It doesn't matter that you are using JSP to generate the HTML page, either. The resulting HTML page, you will want to have a JavaScript tree in it.

Unless you don't mind just using <ul> and <li> elements in your HTML, that is. When you said "Tree" I assumed you meant a component where you can click on nodes to expand subtrees and so on. If that's the case then you'll need some JavaScript to make that happen.
 
Bilal Ghayad
Ranch Hand
Posts: 44
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Paul;

Thank you a lot.
Using ul and li with JavaScript is very good.
But how to make the lines that connect the nodes together and the subtrees together which on the same level (line or dot line), how to have this?

Regards
Bilal
 
Marshal
Posts: 67388
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, this is nothing that JSP can help you with. You'll be using a combination of HTML, JavaScript and CSS to accomplish this. (As such I have moved this to the HTML forum.)

Note: for the connections, unicode has characters that can help. Starting here may be helpful.
 
Bilal Ghayad
Ranch Hand
Posts: 44
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is not condition to be JSP, I just used JSP because I am using Spring MVC.
I need solution in to be done using html, JavaScript and CSS. How?

I posted this question in Java forum because I was think if there is such thing in Java that can be returned to the page (to the browser) to be displayed. But if this is not existed in Java, then I would to do this using html, JavaScript and CSS, but how?

Regards
Bilal
 
Paul Clapham
Marshal
Posts: 25436
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bilal Ghayad wrote:if there is such thing in Java that can be returned to the page (to the browser) to be displayed



That's not how web applications work. What you have on the client side, i.e. in somebody's browser, consists of HTML, JavaScript, and CSS. Like Bear said. You could certainly generate any or all of those things in Java as well as JSP, but there's no magic involved.
 
Paul Clapham
Marshal
Posts: 25436
65
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bilal Ghayad wrote:I would to do this using html, JavaScript and CSS, but how?



You want a JavaScript solution for a tree-structured component? You already know the answer. There are plenty of them online. I searched the web and found an article entitled "The Top 26 Treeview Open Source Projects", just for example. So there are plenty to choose from.

(I will move the thread to the JavaScript forum so that it becomes on topic.)
 
We're all out of roofs. But we still have tiny ads:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic