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 6220257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:55:35+00:00 2026-05-24T07:55:35+00:00

This question is mainly directed at the PrimeFaces dev team but maybe someone else

  • 0

This question is mainly directed at the PrimeFaces dev team but maybe someone else knows a workaround. I can’t upload screenshots on the PrimeFaces support forums but I can link to my question here.

Reported in PrimeFaces support forums: http://primefaces.prime.com.tr/forum/viewtopic.php?f=3&t=14022

I have a <p:tree> in my webapp that has selection="single" mode set. Node selection is working normally when the <p:tree> is not inside a <p:dialog> as shown here:

Works OK when not inside a dialog

However, when the <p:tree> is inside a dialog an exception is thrown on the server side each time a node is clicked in the browser. The selection is never registered on the backing bean:

Fails to set selection when inside a dialog

The following stacktrace appears in my server logs once for each time a tree node is clicked by a user in the browser:

    27-Jul-2011 3:21:52 PM com.sun.faces.context.PartialViewContextImpl processPartial
INFO: java.lang.NullPointerException
java.lang.NullPointerException
    at org.primefaces.component.tree.TreeRenderer.decode(TreeRenderer.java:53)
    at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787)
    at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1181)
    at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:506)
    at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1589)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIForm.visitTree(UIForm.java:344)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600)
    at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376)
    at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:252)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:931)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

Here is the offending PrimeFaces method:

@Override
public void decode(FacesContext context, UIComponent component) {
    Tree tree = (Tree) component;
    Map<String,String> params = context.getExternalContext().getRequestParameterMap();
    String clientId = tree.getClientId(context);
    TreeModel model = new TreeModel((TreeNode) tree.getValue());

    if(tree.getSelectionMode() != null) {
        String selection = params.get(clientId + "_selection");

        String instantUnselection = params.get(clientId + "_instantUnselection");
        boolean isSingle = tree.getSelectionMode().equalsIgnoreCase("single");

        if(selection.equals("")) {
            if(isSingle)
                tree.setSelection(null);
            else
                tree.setSelection(new TreeNode[0]);
        }
        else {
            String[] selectedRowKeys = selection.split(",");

            if(isSingle) {
                TreeNode selectedNode = treeExplorer.findTreeNode(selectedRowKeys[0], model);
                tree.setSelection(selectedNode);
            }
            else {
                TreeNode[] selectedNodes = new TreeNode[selectedRowKeys.length];

                for(int i = 0 ; i < selectedRowKeys.length; i++) {
                    selectedNodes[i] = treeExplorer.findTreeNode(selectedRowKeys[i], model);
                    model.setRowIndex(-1);  //reset
                }

                tree.setSelection(selectedNodes);
            }
        }
    }

    decodeBehaviors(context, component);
}

The line that causes the exception is this one:

        if(selection.equals("")) {

In the case where the <p:tree> is located inside a <p:dialog> the value of selection is always null.

Any idea how to work around this issue?

I am using today’s nightly build of PF 3.0-M3-SNAPSHOT. Same thing happens with PF 3.0-M2. Exhibits the same behavior in both IE 7 and Firefox 4.0.1.

  • 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-05-24T07:55:36+00:00Added an answer on May 24, 2026 at 7:55 am

    Discussed on PrimeFaces forums. Similar issue found by another user.

    Opened PrimeFaces issue ticket here.

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

Sidebar

Related Questions

This question in mainly pointed at C/C++, but I guess other languages are relevant
This question is mainly geared towards Zend in PHP, although it certainly applies to
This question is mainly out of curiosity (I have a different working solution to
This question is mainly to verify my current idea. I have a series of
I guess this question was asked in one way or another, but I'm looking
This question sounds so easy I can't believe I can't find information on it
I am posting this question after reading other similar questions about my problem but
I've asked a question similar to this but thought I would ask a more
This question is kind of an add-on to this question In C#, a switch
This question and answer shows how to send a file as a byte array

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.