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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:26:52+00:00 2026-06-06T03:26:52+00:00

I was playing around with primefaces components, when I stumbled upon this issue… I

  • 0

I was playing around with primefaces components, when I stumbled upon this issue…

I have a sample page which contains the following,

<h:form>
  <p:panel id="p1">
  <p:commandButton value="display" actionListener="#{myTestBean.display}" update="p2">     </p:commandButton>

  </p:panel>

  <p:panel id="p2" rendered="#{myTestBean.show}">

  <p:inputText value="#{myTestBean.val1}" id="t1"></p:inputText>
  <p:inputText value="#{myTestBean.val2}" id="t2"></p:inputText>
  <p:commandButton value="click me" update="@form" action="#{myTestBean.disply}"></p:commandButton>

  </p:panel>
   </h:form>

My backing bean contains the following,

 public class Testbean implements Serializable {
    private String val1;
  private String val2;

  private boolean show;

    //getters and setters for the above...

        public void display(){

    if(show == false){
        setShow(true);
    }

}

public void disply(){
    System.out.println("I am here");
    val1 = "hi";
    val2 = "hello";
    if(show == false){
        setShow(true);
    }

}
}

Now, the catch here is, when I click my first button(display) the below panel(p2) gets rendered correctly. But when I click on the second button(click me) the panel gets hidden and also on click of second button it never goes to the backing bean method ‘disply()’.

I have used action listener in the second button but again the same behavior. Also, I have given the update = “p2” in the second button, even that didn’t yield what I wanted.

Could anyone help me out with this and let me know where and what I am doing wrong?

Thank you.

  • 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-06T03:26:54+00:00Added an answer on June 6, 2026 at 3:26 am

    The bean needs to be placed in the view scope in order to remember all previous (ajax) actions on the same view.

    @ManagedBean
    @ViewScoped
    public class TestBean {
        // ...
    }
    

    When the bean is placed in the request scope, then the boolean show would be reinitialized to default false and thus the rendered attribute would evaluate false while JSF is looking for the action method to be invoked and hence the action method would be never found and invoked.

    See also:

    • How to choose the right bean scope?
    • commandButton/commandLink/ajax action/listener method not invoked or input value not updated
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While playing around with one-to-one associations in castle activerecord I stumbled upon the following
After playing around with haskell a bit I stumbled over this function: Prelude Data.Maclaurin>
Just playing around with interfaces and I have a question about something which I
Playing around in order to learn XSLT, I have the following XML file and
Been playing around with this for a couple of hours and can't seem to
I'm playing around with writing a web app. In this case, I'm using scotty
Playing around with generating text randomly with each page refresh using php. Is there
Just playing around with Rails 3.1 at the moment, and one issue I'm having
I have been playing around with various methods of making the Visitor pattern in
I've been playing around with Simple.Data and have run across something that I can't

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.