2 Replies Latest reply on Apr 12, 2012 4:45 PM by David Glendenning

    rich:popupPanel problem with ViewScoped beans

    David Glendenning Newbie

      Hello. I am having some problems with using actions and popupPanels in my application I am writing. When I peform any action on a popupPanel a new backing bean is being created.


      I made a little test case which is as simple as I can make it, test 1 - 3 have the problem but test 4 doesn't, but that will not do what I want it to do in my application. Can anyone see a problem that I am over looking?


      I am running this on JBoss AS7 with Richfaces 4.2.0, I had been using richfaces 4.0.0 until today with the same problem.

      I have also attached the eclipse project.



      <?xml version="1.0" encoding="ISO-8859-1" ?>

      <!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"






      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

      <title>Popup Test</title>






                          <h:form id="form1">

                                    <a4j:commandButton value="Test 1"


                                              oncomplete="#{rich:component('popup')}.show(); return true;"


                                              <a4j:param name="text" value="f:param text 2" />


                                    <a4j:commandButton value="Test 2"

                                              action="#{testBean.updateDescription('action text')}"

                                              oncomplete="#{rich:component('popup')}.show(); return true;"

                                              render="popup" />

                                    <a4j:commandButton value="Test 3"


                                              render="@all" />

                                    <a4j:commandButton value="Test 4"

                                              onclick="#{rich:component('popup')}.show(); return false;"

                                              render="popup" />







                <rich:popupPanel header="info" id="popup" autosized="true" show="#{testBean.showPopup}">

                          <f:facet name="controls">

                                    <h:outputLink value="#"

                                              onclick="#{rich:component('popup')}.hide(); return false;">




                          <h:form id="popupForm">

                                    <h:inputText value="#{testBean.description}" />

                                    <h:outputText value="#{testBean.description}" />

                                    <a4j:commandButton  execute="@form" render="popupForm" />











      package webtest;



      import java.io.Serializable;

      import java.util.Map;



      import javax.faces.bean.ManagedBean;

      import javax.faces.bean.ViewScoped;

      import javax.faces.context.FacesContext;



      @ManagedBean(name = "testBean")


      public class TestBean implements Serializable{



                private static final long serialVersionUID = 1L;

                private String description;

                private boolean showPopup = false;


                public TestBean(){

                          System.out.println("New TestBean");




                public String getDescription() {

                          return description;




                public void setDescription(String description2) {

                          this.description = description2;



                public boolean isShowPopup(){

                          return showPopup;



                public void updateFromParam(){

                          FacesContext context = FacesContext.getCurrentInstance();

                          Map<String, String> params = context.getExternalContext() .getRequestParameterMap();

                          description = params.get("text");


                          System.out.println("ActionEvent fired, updateFromParam() description = " + description);



                public void updateDescription(String value){

                          description = value;

                          System.out.println("ActionEvent fired, updateDescritpion() description = " + description);



                public void showPopup(){

                          showPopup = true;

                          description = "show attribute";

                          System.out.println("ActionEvent fired, showPopup() description = " + description);




      Thanks in advance, Dave