3 Replies Latest reply on Mar 30, 2015 6:05 AM by byte slash

    rich:tree with h:link issue

    byte slash Newbie

      Hi everyone,

       

      I've been using rich:tree component since richfaces 3.3.3 and with the jboss seam s:link everything was running just fine. In a new project i've upgraded the platforms to JEE7 and Richfaces 4.5.3 and so far i'm going nuts with the behavior of the combination rich:tree with h:link for navigation menu. What i have is this:

       

      1. Tree backin bean in CDI, Viewscoped

      2. facelet templated pages

      3. left menu with the tree :

       

      <rich:panel xmlns="http://www.w3.org/1999/xhtml"
        xmlns:s="http://jboss.com/products/seam/taglib"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:rich="http://richfaces.org/rich"
        xmlns:p="http://primefaces.org/ui" xmlns:a4j="http://richfaces.org/a4j">
      
        <f:facet name="header">Menu</f:facet>
      
        <h:form>
            <rich:tree id="tree" nodeType="#{node.type}" var="node" treeStateAdvisor="true"
                       value="#{treeBean.rootNodes}" selectionType="ajax"
                       selectionChangeListener="#{treeBean.selectionChanged}">
                <rich:treeNode type="menuTree" expanded="true">
                          #{node.name}
                      </rich:treeNode>
                <rich:treeNode type="menuBranch" expanded="true">
                          #{node.name}
                      </rich:treeNode>
                <rich:treeNode type="menuSubBranch" expanded="true">
                          #{node.name}
                      </rich:treeNode>
                <rich:treeNode type="menuLeaf" expanded="true">
                    <h:link value="#{node.name}" outcome="#{node.link}.xhtml" />
                </rich:treeNode>
            </rich:tree>
        </h:form>
      </rich:panel>
      

       

       

      What it happening is that the tree loads fine when i do login on the Webapp. When i click on the link with this result  code

      <span class="rf-trn-lbl"><a href="UserStep0-form.jsf">Register</a></span>

      the selected link page is loaded correctly, but after that

      the page is reloaded and the h:link renders <span class="rf-trn-lbl"><span>Register</span></span> the <a ref .... /> simply disappears and i cant load any other page from the rich:tree.

       

      Any ideas ? Thanx in advance

        • 1. Re: rich:tree with h:link issue
          Michal Petrov Master

          <h:link> will render a span when the navigation case cannot be resolved, meaning the link is not valid. If you're not using navigation cases in faces-config.xml I think it will only try to resolve a relative path.

           

          If you were using development stage you'd see a warning message: "Register: This link is disabled because a navigation case could not be matched.". To turn it on open your web.xml and change the value of "javax.faces.PROJECT_STAGE" to "Development".

          • 2. Re: rich:tree with h:link issue
            byte slash Newbie

            Hi, Michal Petrov,

             

            First of all thank you for your attention on this matter. The thing is i'm not using navigation cases in faces-config.xml and the required behavior is to resolve a relative path link which is obtained from the database and this only executes perfectly for the first click on the link and the page is correctly visualized. after that the <a> refs on the nodes disappear with no reason.

             

            Any insight on it ?

             

            Thank you

            • 3. Re: rich:tree with h:link issue
              byte slash Newbie

              Hi Michal,

               

              After several tests i've figure out what was the real problem, i was missing the required forward slash on the path for the link.

              Thank you , once again.