Skip to main content

jmaki binding to java source

2 replies [Last post]
Joined: 2009-01-08


i have created a virtual web page with netbeans 6.1! I used the jmaki framework for this site and in the designer i added a "jmaki Yahoo tree". My problem is, i want to create the tree from a database dynamically and also use an event by clicking on the tree. For other components you can use a binding attribute (like: binding="# {MainScreen.test}) and so you are able to reach this elements in the java code section and write down the actions in java(for example: button1.action = ...). I also want to do this for this jmaki tree!
Here is a code sample:

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-09-14

Hi schili1985,

Thank you for your interest in jMaki. You would be able to achieve what you are wanting to do by using the service attribute of of the tree. The service would dynamically create the tree for you. To learn more about the tree model please see . If you notice in the model there is an action defined (see below). If you assign a specific topic to this action you would be able to call the subscribed function.

[b]Tree Widget Model Example[/b]
{ label : 'Node 3.1',
action : { topic: "/yourtopic/onClick", message : { targetId : 'bar'}}

If I understand your post correctly you then want to associate this call with an Action on the JSF managed bean. To do this you would add the following call in your subscribed function in glue.js. This will make the call to your managed bean via a post using an async call. If you look at the url you will notice that the format is {path}/{BeanName}-{ActionMethod}.ajax


method : "POST",
url : jmaki.webRoot + "/faces/ManageBean-actionMethod.ajax",
content : { cmd : "setValue" , value : "UpdateModel", name : "Sloan" },
callback : function(req){
jmaki.log("Back from call")

onerror : function(req) {
jmaki.log("Error loading Patient Demographics");


On the bean side you need your method in this format to accept an async call from jmaki.

[b]Managed Bean Action[/b]
public void actionMethod(FacesContext context, AjaxResult result)
HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();

// Get the command
String command = request.getParameter("UpdateModel");

// Set the values of the bean


I hope this helps you out. As always please feel free to ask any questions you may have. We appreciate your support by using jMaki.


Joined: 2008-06-12


May be a solution is to create a bean in your proyect and call the bean from the web page (the jsp file) using the construction <% frijoles.frijolArbol newTree = new frijoles.frijolArbol(); %> to initialize the bean before using it and to add this type of constructions when you want to use the bean.
Obiously all the logic to acces the data base is in the bean using th full powed of java.