2 Replies Latest reply on Dec 20, 2011 4:47 AM by Adrien Adrien

    RF4.1-Final : rich:PickList problem ajax&requestScope (work viewscope)

    Adrien Adrien Apprentice


      I ve a strange behaviour with a picklist updated with ajax, all work when the back bean is viewscope but validation error appears when the bean is request scope (I m currently migrate from RF 3.3 to RF 4.1.final, and it worked in RF3.3).


      I ve put a simple example :

      - a select which on value change update a picklist (choices: c0, c1)

      -a picklist : display selected list

      -a h:commandButton to execute anything



      -Load the page, choice is c0, change  it to c1

      -picklist is updated

      -dbl click on a left item from picklist  to add it as selected

      -click the button search

      if  scope bean  is view => all work

      if scope bean is request =>error of validation is displayed

      If any body has an idea ....

      Thanks for your help




      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


      <html xmlns="http://www.w3.org/1999/xhtml"













                <f:view contentType="text/html">

                          <h:form id="advSearchForm">                              

                                    <h:selectOneMenu id="c" value="#{CtrlTestPickList.currentchoice}"    valueChangeListener="#{CtrlTestPickList.choiceChanged}">

                                                        <f:selectItems value="#{CtrlTestPickList.choices}" />

                                                        <a4j:ajax event="valueChange" execute="@this" render="dpts    />


                                    <br />



                    <rich:pickList  id="dpts"  value="#{CtrlTestPickList.selectedItem}"  listWidth="170px" listHeight="100px"      >

                                              <f:selectItems  value="#{CtrlTestPickList.currentlist}" />


                 <br />




                                    <h:commandButton id="search" value="search" action="#{CtrlTestPickList.search}" >

                                              <f:ajax    execute="@form" render="@form" />















      import java.io.Serializable;

      import java.util.ArrayList;

      import java.util.Hashtable;

      import java.util.List;

      import java.util.Map;



      import javax.faces.bean.ManagedBean;

      import javax.faces.bean.RequestScoped;

      import javax.faces.bean.ViewScoped;

      import javax.faces.event.ValueChangeEvent;

      import javax.faces.model.SelectItem;




      //error on request


      //work viewscope

      // @ViewScoped

      public class CtrlTestPickList implements Serializable {




                private static final long serialVersionUID = 1L;

                List<SelectItem> choices= new ArrayList<SelectItem>();



                String currentchoice="c0";

                List<String> selected;

                List<String> selectedItem;

                Map<String,List<SelectItem>> model=new Hashtable<String, List<SelectItem>>();

           public CtrlTestPickList() {

                    for (int i = 0; i < 2; i++) {

                              ArrayList<SelectItem> l = new ArrayList<SelectItem>();

                              choices.add(new SelectItem("c"+i, "c"+i));

                              model.put("c"+i, l);

                                    for (int j = 0; j < 5+i; j++) {

                                              l.add(new SelectItem("l"+i+"-"+j, "list"+i+"-"+j));








                public String getCurrentchoice() {

                          return currentchoice;


                public void setCurrentchoice(String currentchoice) {

                          this.currentchoice = currentchoice;


                public List<SelectItem> getCurrentlist() {

                          return model.get(currentchoice);



                public List<SelectItem> getChoices() {

                          return choices;


                public void setChoices(List<SelectItem> choices) {

                          this.choices = choices;



                public void choiceChanged(ValueChangeEvent event) {


                          System.out.println("choiceChanged(ValueChangeEvent) new value-->"+event.getNewValue()+"  "+this.getClass().getName());


                          if (null != event.getNewValue()) {

                                    currentchoice=(String) event.getNewValue();





                public String search(){


                          return "";


                public List<String> getSelectedItem() {

                          return selectedItem;


                public void setSelectedItem(List<String> selectedItem) {

                          this.selectedItem = selectedItem;