I have the method written to populate the list, and when I call the method and print the alues it doesshow that the list was populated like I want. So I thought the next part would be simple, I would just have setter and getter for the list and bind this to my tree. But when i did this I get an error saying
roots="#{tempTreeBean.ids}": Error reading 'ids' on type testContainer.Temp
So it looks like to me that teh tree is trying to pull the vaues from my list before the method to populate the list is being invoked. So how do I tell my rich tree to call the method to load the list before trying to add that list as the branches of the tree? I tried just putting a method call in the getter to load the list, but no good. I am wondering if there is just some attribute I can add to the rich tree tag that will tell it to first call the method to load the lst with values, and then try to use that list to populate the branches
edit - essentially Im needing to tell my jsf page "invoke this method to load the list before you do anything else, then use this list to populate the tree"
True wisdom is in knowing you know nothing - Socrates
First check whether your getter/setter has a valid signature. I think it should not be static.
If you do not wish to call the method that populates your list everytime you invoke the getter put it in the BackingBean constructor
If your TempTreeBean is in request scope, the loadList() will be invoked per request, if it is in session scope then per session
When I call the loadNodes method followed by the print method it prints out the deviceIds like I expect, so it looks like everything is working as intended. However if I bind ids to my tree it gives me this stack:
javax.el.ELException: /test/treetest.xhtml @18,75 roots="#{tempTreeBean.ids}": Error reading 'ids' on type testContainer.Temp
com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
org.richfaces.component.html.HtmlRecursiveTreeNodesAdaptor.getRoots(HtmlRecursiveTreeNodesAdaptor.java:181)
org.richfaces.component.UIRecursiveTreeNodesAdaptor.getData(UIRecursiveTreeNodesAdaptor.java:55)
org.richfaces.component.UITreeNodesAdaptor$1.getData(UITreeNodesAdaptor.java:54)
org.richfaces.model.StackingTreeModel.getDataModel(StackingTreeModel.java:83)
org.richfaces.model.StackingTreeModel.doWalk(StackingTreeModel.java:309)
org.richfaces.model.StackingTreeModel.walk(StackingTreeModel.java:381)
org.richfaces.component.UITree.walk(UITree.java:422)
Thats not all of it but it is the beginning. But when I click on line 76 or 181 there it tells me the source isnt attached, and when I try to figure out where the source is to attahc I have no luck with it.
Someone else has suggested using @PostConstruct annotation to resolve this so Im looking into that now but it is the first time Ive heard of that
Kavita Tipnis
Ranch Hand
Joined: Sep 21, 2008
Posts: 177
posted
0
For debugging purpose, just add to ids manually(as in "1","2") , that should just be a 2 min work, check if that is throwing any error
So now my only guess is that method just doesnt want to work when invoked from the server, only the client, but that is just a pure guess really.
Here is the method that is giving all the hassle:
Then I have a main method in another class to invoke the loadnodes and print methods:
And the result is
Printing ids list: [exampleDevice1]
Here are the other two classes that are instanced in temp:
But now were getting into my other problem, which is that it is not easy to just look at all of this code and find the problem, one would need to test it, which is what I am supposed to be doing. Ce la vie