0 Replies Latest reply on Feb 11, 2013 11:58 AM by Ken Clahrc

    seam2.2 to 2.3 upgrade nullifies backing beans on page submit

    Ken Clahrc Newbie

      I have another problem with backing bean's variables being nullified - similar to what I've already asked about here "https://community.jboss.org/thread/221009"


      Below is a part of a seam-generated *Edit.xhtml page. Both fields' drop down list values ('sistes', 'wards') are List type member variables in 'medmanNwlhFieldOptions' Seam component.

      Selecting values from the 'sites' drop down fires a valueChange event which sets the drop-down values of 'wards'. Selecting then a ward from the list and clicking on the page's 'Save' button results in a 'invalid value' error message for the 'wards' field.

      I tried debugging it and all looks OK with the backing beans and its member values up to the point when the request is sent to the server by clicking 'Save' after which point the backing bean's 'wards' list variable is nullifed and I get the error message.

      It seems to me processing of the request re-instantiates the backing bean before the Validation phase and as expected the value would be null at that point.

      I can make work if I explicitly specify a 'Session' scope. Isn't the 'Conversation' scope components supposed to stay alive in this case ?

      This is another one of problems I've getting from upgradiing from seam2.2.2.final/jsf1.2/rf3.3.3 to seam2.3.0.final/jsf2/rf4



      . . . 
                 <s:decorate id="siteField" template="layout/edit.xhtml">
                      <ui:define name="label">Site</ui:define>
                      <h:selectOneMenu id="site" value="#{medmanNwlhHome.instance.site}" required="true" 
                             <f:selectItems value="#{medmanNwlhFieldOptions.sites}" itemLabelEscaped="Click to select..."/>
                          <a:ajax event="change" render="ward" oncomplete="onAjaxRequestComplete()"/>
                  <s:decorate id="wardField" template="layout/edit.xhtml">
                      <ui:define name="label">Ward</ui:define>
                      <h:selectOneMenu id="ward" value="#{medmanNwlhHome.instance.ward}" required="true">
                             <f:selectItems value="#{medmanNwlhFieldOptions.wards}" itemLabelEscaped="Click to select..."/>
                          <a:ajax event="change" render="wardField" bypassUpdates="true" oncomplete="onAjaxRequestComplete()"/>
      . . . 



      here's the backing bean:



      package clahrc.utilities.fieldoptions;
      import java.io.Serializable;
      import java.util.ArrayList;
      import java.util.Collections;
      import java.util.Hashtable;
      import java.util.List;
      import java.util.Map;
      import javax.faces.event.ValueChangeEvent;
      import javax.faces.model.SelectItem;
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      public class MedmanNwlhFieldOptions implements Serializable {
          private static final long serialVersionUID = 1L;
          private List<SelectItem> sites = Collections.checkedList( new ArrayList<SelectItem>(), SelectItem.class );
              // populate the sites list
          public List<SelectItem> getSites() {
              return sites;
          private Map<String,List<SelectItem>> wardMap = new Hashtable<String,List<SelectItem>>();
                // populate the wardMap with wards lists
          private List<SelectItem> wards = Collections.checkedList( new ArrayList<SelectItem>(), SelectItem.class );
          public List<SelectItem> getWards() {
              return wards;
          public void changeWards( ValueChangeEvent event ) {
              wards = wardMap.get( event.getNewValue().toString() );