Need some help or need to help me where to look for

I’m trying to create a portlet implements some menu.
I have one web service conains two methods

  1. One of them is getRootMenus() ( which given the root menus), given a list of menu document.
    A menu document contains the following variable
  • ID (ID of menu)
  • Title (which is the string displaid for the menu)
  • HasContains (a Boolean which is true or false, if it is true, a panel is displaid, if it is false, the panel is not displaid)
  • ParentID (contains the ID of parent menu if it is a child menu)
  • isRoot (true if it is a root menu, false if not)
  1. The second method getMenusOfParent() give the list of menus of a parent menu.

I prefer to say we dont know how manly level we have.
If a menu has no children, it is a leaf, else if we click on this menu, we need to see the children displaid.

I have two problem :

  • I dont know how to bind a BaseAppNavBean to the result of my method of web service (for instance getRootMenus)
  • I don’t know how to create dynamically a static submenu each time we click on a menu which havec children menu.

I guess you will not give me the solution like that. But I want to know where I can find some tips or documenation about the structure of html objects in CAF with some example in java showing how to handle them and I want to know where I can find documentations to create dynamically (in java) some controls.

Thanks for your support

For simplicity, maybe you can create a new web service that transforms your model into the xml format that the XMLAppNavPage implementation already knows how to handle. If you get the xml string back in one shot, you only have to make one round-trip to the remote webservice.

For example, the xml stucture that the XMLAppNavBean knows how to parse would look something like this:


And then you can create a getter method in your page bean that creates the XMLAppNavPage object from your data with something like this:

	private XMLAppNavBean customAppNavBean = null;

	public XMLAppNavBean getCustomAppNavBean() {
		if (customAppNavBean == null) {
			try {
				customAppNavBean = new XMLAppNavBean();
				String xmlString = "[TODO - get your xml string from your model here]"; 

				//let the bulder parse the xml and construct the nav model
				XMLAppNavBuilder builder = new XMLAppNavBuilder(getFacesContext(), null);
				SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
				InputSource inputSource = new InputSource(new StringReader(xmlString));
				saxParser.parse(inputSource, builder);

				IAppNavPage root = builder.getRoot();
			} catch (Exception e) {
		return customAppNavBean;

And then you can bind the “App Nav Bean” property of the “Popup Menus”, “Static Menus”, or “Toggle Menus” control to an expression that resolves to your getter method. for example, something like this: #{DefaultView.customAppNavBean}

Maybe it is a good idea I will try when I will work again on my project

When I see ypur XML structure, it look like to a BaseAppNavBean component but it is not exactly the same. So I didn’t start my service to get the menu hierarchie because it need to think about this, because it need a recursive service (a service which call himself) and it is not good with document variables (containing children which is the document itself). So as you suggest I need to fill a xml file.
But I think about it after and I wonder if it is possible to create a document variable with the same structure than the BaseAppNavBean component. As we can see in Managed Bean in Binding, it look likes a document. So I wonder if it exists a Package where we can fin the definition of any CAF component ?