This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Collapsable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Collapsable "folder" with JSP/JSTL" Watch "Collapsable "folder" with JSP/JSTL" New topic
Author

Collapsable "folder" with JSP/JSTL

Mike Himstead
Ranch Hand

Joined: Apr 12, 2006
Posts: 178
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

Joined: Jan 10, 2002
Posts: 60800
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mike Himstead
Ranch Hand

Joined: Apr 12, 2006
Posts: 178
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

Joined: Jan 10, 2002
Posts: 60800
    
  65

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.
 
 
subject: Collapsable "folder" with JSP/JSTL
 
Similar Threads
collapsable list
an expandable/collapsable tree view
Collapsable contents
Single collapsable panel component
Role based Authorization for Tree Structure