• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collapsable "folder" with JSP/JSTL

 
Mike Himstead
Ranch Hand
Posts: 178
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone ever done something like a collapsable tree structure with JSP / JSTL only? I have a page which looks like a tree structure to the user but is a properly idented list only. Users now want to collapse "folders" and the enterprise has a strict ban on JavaScript (I don't know JavaScript anyway), so JSP/JSTL is the only option.

The list contains view beans which offer access to more basic business objects (the elements that make up the list are part of them). My first approach was to manipulate the view beans setting a flag (like hideChildren) and let the jsp evaluate the flag. With this approach I have to reload the page, of course, and this demands that I hand over or store the list with the view beans in the browser. This is the point where I start to think this is an awful way to achieve the goal. Is there any other way of doing this?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mike Himstead:
With this approach I have to reload the page, of course


Unless you can get the ridiculous ban on Javascript lifted, you have no recourse but to reload the entire page every time you want to effect a change.
 
Mike Himstead
Ranch Hand
Posts: 178
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your answer. Given the possibility that I can use JavaScript, are there any further prerequisites on the JSP side to make it work with JavaScript? Since I have no clue about JS I find it hard to identify possible problems with the current structure. As mentioned above, the structure is a properly sorted list which is displayed by going through it with c:forEach. Some elements are indented to make up a tree-like look, these are the sub-elements. To put it otherwise: there aren't any <li> right now.
[ January 12, 2007: Message edited by: Mike Himstead ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can put whatever Javascript you want on the page and the JSP engine will not care. It will just be uninterpreted template text like all the other client-side markup. You could have your pet iguana type it in by walking across the keyboard for all the JSP engine will care.

This article might be helpful if that still seems odd to you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic