• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

generate java script code on th fly

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

In my application I need to generate a Java script coded Tree which will be dynamic in nature. This should be generated dynamically by the program.
The nodes in the tree are taken from the database on the fly. Those nodes can be taken and will be used to construct the java script source to generate the required tree.

Another issue may be of java script..how to keep access control for node clicks

plz help me

thanks in advance and will be highly appreciable
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what the promlem?

1. Create javascript object "Tree" with method
like addLeaf(level, caption, url); (statically included)
2. The dymanically invoke this method using db's data (dynamicaly generated)

so result of jsp will be like this
<script>
Tree.addLeaf(1, "Folder 1", null);
Tree.addLeaf(2, "Sub Folder 1", "http://.../?sds=1&ddd..");
Tree.addLeaf(2, "Sub Folder 2", "http://.../?sds=2&ddd..");
Tree.addLeaf(1, "Folder 2", null);
</script>

using construst similar to this
<% for (......) { %>
Tree.addLeaf(<%=level>, "<%=caption%>", <%=url%> );
<% } %>

All you need to know is javascript and jsp.
[ February 23, 2005: Message edited by: Eugene Lucash ]
 
Hareesh Ram Chanchali
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Lucash,

Thank for reply

please be eloborated with the flow of data ...

can please tell how i can keep access control for each node (that is all the nodes are not accessible for all) I want to restrict that access
 
Eugene Lucash
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
flow highly dependant on structure of database query & resultset.

About access. What security mechanism do you use (db, http declarative, manual)?

To restict access using db you can construct your query in such a way, that
restricted nodes will not be in result.

if you using http roles you can
do
<% if(request.isUserInRole("admin")) { %>
<!-- write node -->
<% } %>
 
Hareesh Ram Chanchali
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Levelwise security mechanism will be taken from database
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic