Sorry, I shouldve updated this, but I did realize I was missing a form and view tag. I added them, but NOW only a blank page gets displayed when I try to run it on my local server. ANy ideas?
So the new code:
edit - I also tried it with a4j:form instead of h:form but still get a blank page.
I know it has to be some combination of the crrect tags and order of the tags but I feel like I ahve tried every variation
I dont know if this will help, but I put this into a two column table, on the left column, to see if it would display a blank space for that cell or if the table would act as if there was nothing in the cell. It did just the latter, The left column was gone, and the stuff that I put in the right column took up the entire row.
I have no idea what this means, but hopefully someone with more experience wil?
here is a part of a reply I got on the richfaces forum:
"tree could not be created declarativelly. check our samples and documentation and create proper dataModel for the tree."
So if I am interpreting this correctly this person is saying I cant define nodes in that manner? Meanign I cant just assign values statically, it must be done dynamically with managed beans or some such? The post was somewhat difficult to interpret because the poster was from Belarus
The documentation for RichFaces was written by someone whose native language was not English. Unfortunately, I think it was one of the languages related to English, so the differences are just subtle enough to be more confusing than if they had grown up speaking Tamil.
Here's my dynamic tree code:
I told you it was ugly.
I used the RichFaces reference guide to build the model itself, but thanks to the languages issues, the resulting code is just too awful to show.
I do have this working now as intended. I am wondering about something still so if you have an answer please feel free...
Rigt now my data source is a .properties file. This data from the .properties file is used to display the tree. But Im not sure if this is going to work for my project. All the data that will populate the nodes is located on a web service, with this format:
The nodes will be populated from the name, devices, and channels elements. So Im not yet sure how to translate this to the tree. I can deserialize the data with a method I have. Is it possible to generate temporary .properties files that last for the session? Or does anyone know a better way to take the data from those three elements and use them to populate the tree nodes? FYI, I havent started looking into this at all yet, so there may be an obvious answer out there. If so please feel free to tell me to just do my research X-)
Mu username is meghiddo there, so just search from some of my posts to see the many many questions I have had about them (including regarding the problem your having - you cant declare nodes declaratively or something liek that, I dont remember exactly)
Well it involves quite a few classes, but the main two are the ProjectHolder class, which is just an Object to hold all the variables, and then a Nodes class which performs the operations to give those variables values and then load each instance of the ProjectHolder object into a List. Then I bind that list to the rich:tree.
And dont let my troubles with it scare you, I had just started learning about jsf back then and my java was very rusty. Plus the tree was just one of a great many different things I had to do, so that whole three months wasnt just for the tree. First the ProjectHolder class that just declares the variables and setters and getters for them:
And my nodes class which loads the ProjectHolder class variables with values (values taken from a web service) and then for each instance of that ProjectHolder Object it loads the ProjectHolder Object into a List:
Then I declare a managed bean in faces-config:
And last the tree itself:
If you want to see any of the other classes that are involved that you see in the code just tell me which ones, but that should give you the general idea of how I did mine. There are many different ways to do a tree though, it all depends on what you are needing. Mine was complex because the tree is generated dynamically depending on what is added and deleted from the web service. But if your making a tree that will always have the same roots and nodes that is fairly simple.
Joined: Jul 10, 2009
i just realize, my web.xml is not the same like your web.xml.
You can looked at the codes that i circled with a red color.
My web.xml didn't have that code.
Did you add that code manually or is it automatically there?
That is actually one of their few samples I could get working.
Your problem is probably from this line of the SimpleTreeBean.java source:
private static final String DATA_PATH = "/richfaces/tree/examples/simple-tree-data.properties";
you have to either create that Data Path, or change it there. So step one is to create a .properties file, they have it named simple-tree-data.properties, and copy and paste that long list of artists and works they have under "Open Data File". Just open that and copy and paste all that into your .properties file and save it. Now depending on where you saved it you will need to change the private static final String DATA_PATH = "/richfaces/tree/examples/simple-tree-data.properties"; line from the java code. If you saved your .properties file under the WebContent folder, then that line would simply be changed to
private static final String DATA_PATH = "/WebContent/simple-tree-data.properties";
The bottom line is, you have to create that .properties file and then in the java source code change the Data Path so it knows where to find it.
Hope that makes sense.
And yes, it is sometimes very hard to get any answers from the JBoss forums. I used a combination of this forum and that forum to get things going.
Joined: Jul 10, 2009
i don't know how to say thank you to you.
You answer me very fast. I really really thank you once again.
Anyway, you forgot to answer my first question.
The Project where you made tree is Seam Web Project, right?
And you run that project on JBoss?? Or from TomCat?
Because my project is Seam Web Project with the Runtime JBoss AS 4.2 (Which means : it run from the Server JBoss).
I believe the answer to your question is JavaServerFaces v1_2 project if I understand what your asking. And I use Tomcat configuration, I like it much more than JBoss.
I made a word doc with setup instructions and put all the JARs I use in a zip file for my group members to help them catch up with me when I started this project, so Ill give you the url to download that if you want to look at it. Basically I go through setting up a project from the beginning in it with screenshots. Plus there are a lot of useful JARs there if you ever need them. Just open read_me.doc to see the setup and the JARs are all in a separate folder
take a look and get back to me if you need anything else about it. I would send you my full project code to look and play with, but right now am under an NDA so I cant do that
Joined: Jul 10, 2009
i thank you once again for being very helpful to me.
I really trully appreciate it.
Well, because you already made it. You can make a tree with Richfaces, so i want to do exactly what you did when you made a RichFaces tree.
I want to do 100% the same as you.
And when i saw your web.xml, there are 4 beans ( AddAll, ProjectTreeTest, DeviceTree, Address).
But because i didn't have those beans.