Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7967229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:38:21+00:00 2026-06-04T06:38:21+00:00

I’m new to JSF programming and have designed a rather simplistic JSF 2.0 web

  • 0

I’m new to JSF programming and have designed a rather simplistic JSF 2.0 web application. It features a rich:tree on the left which acts as a hierarchical menu. When the user clicks something in the tree, a selection handler is fired and a partial reload of the page is triggered which shows content related to what you just clicked.

The problem is that the interface feels sluggish, so I enabled some logging and added a custom phase listener to give me some idea of where the bottlenecks are.

2012-05-21 07:58:05.516 DEBUG NodeBean - Retrieving properties
2012-05-21 07:58:05.516 DEBUG CustomPhaseListener - Before phase: APPLY_REQUEST_VALUES 2
2012-05-21 07:58:05.876 DEBUG RepositoryBean - Selection change event invoked (size: 1)
2012-05-21 07:58:05.876 DEBUG RepositoryBean - Selection change event handled
2012-05-21 07:58:05.876 DEBUG CustomPhaseListener - After phase: APPLY_REQUEST_VALUES 2
2012-05-21 07:58:05.876 DEBUG CustomPhaseListener - Before phase: PROCESS_VALIDATIONS 3
2012-05-21 07:58:06.469 DEBUG CustomPhaseListener - After phase: PROCESS_VALIDATIONS 3
2012-05-21 07:58:06.469 DEBUG CustomPhaseListener - Before phase: UPDATE_MODEL_VALUES 4
2012-05-21 07:58:06.844 DEBUG CustomPhaseListener - After phase: UPDATE_MODEL_VALUES 4
2012-05-21 07:58:06.844 DEBUG CustomPhaseListener - Before phase: INVOKE_APPLICATION 5
2012-05-21 07:58:06.844 DEBUG CustomPhaseListener - After phase: INVOKE_APPLICATION 5
2012-05-21 07:58:06.860 DEBUG CustomPhaseListener - Before phase: RENDER_RESPONSE 6
2012-05-21 07:58:06.985 DEBUG NodeBean - Retrieving properties
2012-05-21 07:58:07.001 DEBUG RepositoryBean - Retrieving content
2012-05-21 07:58:07.001 DEBUG RepositoryBean - Content retrieved
2012-05-21 07:58:07.376 DEBUG CustomPhaseListener - After phase: RENDER_RESPONSE 6

The NodeBean is a request scoped bean which has a “getProperties()” method. I have no idea why it is being called in the beginning, but its overhead is minimal so that’s a problem for another time.

As you can see the JSF lifecycle takes ages to complete while the custom code is rather trivial overhead-wise. After some googling, I found that “immediate=’true'” would allow you to skip some steps but adding it to the rich:tree has no effect. I assume that I’m doing something wrong but for the life of me, I can’t figure out what.

On a sidenote: from time to time (usually after some inactivity from the user) the process will stop after phase 3 which means no content is returned to the user. Any selection in the rich:tree will have the same behavior until the user reloads the page.

EDIT:

After some further debugging, it appears that the richfaces tree is rebuilt several times on each request. It is related to this issue: JSF2 Richfaces 4.1.0 Ajax partial rendering of tree

My usecase is: the tree is largely static and if you select an item, the properties & content related to that item should appear on the right. So basically I have a selectionchange listener which registers what you selected and a rerender of a central component that uses that setting to load properties & content. The tree should (almost) never be refreshed. What actually happens though is that the entire tree is rebuilt for stage 2, 3, 4 and 6 even though the partial rerender does not mention or reference the tree.

Initially I had this:

<rich:tree id="tree" var="node"
        value="#{repository.browser}" 
        render="node" 
        toggleType="client" selectionType="ajax"

If you set “selectionType” to client, the problem disappears but of nothing is rerendered or called in the backend.
I tried adding something like

<f:ajax event="click" render=":node"/>

But that failed as well (the tree was still rebuilt in the background).
Is there a way to cache the tree or simply not to rebuild it for every request?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:38:23+00:00Added an answer on June 4, 2026 at 6:38 am

    I have fixed the issue for my particular usecase though I’m not sure how applicable it is to others. I have updated the org.richfaces.component.TreeRange.shouldIterateChildren() method from:

    public boolean shouldIterateChildren() {
        if (tree.getRowKey() == null) {
            return true;
        }
    
        if (tree.isLeaf()) {
            return false;
        }
    
        return traverseAll || tree.isExpanded();
    }
    

    To:

    public boolean shouldIterateChildren() {
        if (tree.isLeaf())
            return false;
        else {
            char separatorChar = UINamingContainer.getSeparatorChar(FacesContext.getCurrentInstance());
            String clientId = tree.getClientId();
            boolean render = false;
            for (String idToRender : FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds()) {
                // render the tree if you explicitly mention either the client id (e.g. "menuForm:tree") or the parent component client id (e.g. "menuForm")
                // note that when clicking on an object in the tree, the following render target is requested: menuForm:tree@selection
                if (clientId.equals(idToRender) || clientId.matches(idToRender + separatorChar + ".*")) {
                    render = true;
                    break;
                }
            }
            // always render if it's not a postback
            return render || !FacesContext.getCurrentInstance().isPostback();
        }
    }
    

    I still have no idea whether I’m using rich:tree wrong or if it’s actually a bug, I have sent a mail to the jboss-users mailing list and will create a jira issue if it turns out to actually be a bug. At least now my web application responds quickly even with a large tree.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.