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

  • Home
  • SEARCH
  • 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 8117851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:18:37+00:00 2026-06-06T04:18:37+00:00

I have a very simple xhtml file where a panelGroup containing a commandButton is

  • 0

I have a very simple xhtml file where a panelGroup containing a commandButton is added to the page on clicking toggle button but this dynamically added commandButton fails to execute its actionlistener on being clicked.

Complete code below:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.org/ui">

    <h:head>
    </h:head>
    <h:body>
        <h:panelGroup id="checkDyna">
            <h:panelGroup rendered="#{listRetriever.booleanStatus}" >
                <h:form>            
                    <p:commandButton value="check" process="@all" actionListener="#{listRetriever.xx()}"/>
                </h:form>
            </h:panelGroup>
        </h:panelGroup>
        <h:form>
            <p:commandButton value="Toggle" actionListener="#{listRetriever.toggleBooleanStatus()}" update=":checkDyna"/>
        </h:form>

    </h:body>
</html>

Bean

@ManagedBean(name = "listRetriever")
@RequestScoped
public class ListRetriever implements Serializable {

    private boolean booleanStatus;        

    public void toggleBooleanStatus(){
        if (!booleanStatus)
            booleanStatus=true;
    }

    public void xx(){
        System.out.println("Invoked***");
    }

    public boolean isBooleanStatus() {
        return booleanStatus;
    }

    public void setBooleanStatus(boolean booleanStatus) {
        this.booleanStatus = booleanStatus;
    }

}

On removing rendered="#{listRetriever.booleanStatus}" actionlistener is successfully invoked.

On making the bean ViewScoped too the problem is eliminated but I dont want to make it wider than RequestScoped.

  • 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-06T04:18:39+00:00Added an answer on June 6, 2026 at 4:18 am

    I had this p:commandButton within a conditionally rendered panel whose conditional expression for rendering was evaluating to false while I was trying to execute the actionlistener. This was the cause of actionlistener not getting executed.

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

Sidebar

Related Questions

I have a very simple JSF 2.0 project. I have an index.xhtml file to
I want to do very simple thing, but I'm not success. I have button
I have a very simple one page website that has a input field in
I have a very simple login page with 1 textbox for username, 1 textbox
I have a very simple page that simply prompts the user for a name
I have the following issue whith this very simple task. I want to create
I have very simple script for submitting the form. This is html template: <table>
I have very simple question but the answer is still not clear. If i
I have very simple aspx page & code: <%@ Page Language=C# AutoEventWireup=true CodeFile=Default.aspx.cs Inherits=_Default
There is probably a very simple answer to this, but I want to be

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.