Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1430

selectOneMenu looses values after clicking immediate link (since 1.1.4)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.1.4
    • 1.1.5
    • General
    • None
    • myFacesCore 1.1.4
      tomahawk 1.1.3
      Tomcat 5.5.17
      jdk 1.5.0.7

    Description

      After updating myFacesCore to 1.1.4 a selectOneMenu with a binding is not working anymore.
      The used version of tomahawk is 1.1.3.

      The entries of the select one menu are cleared after clicking an immediate link.
      The BackingBean BBController has session scope.
      When I go back to myFacesCore 1.1.3 everything works fine!!!
      I attached a small demo webApp that everybody can reconstruct this behaviour.

      JSP snippet:
      <f:view>
      <h:form id="myform">
      <h:panelGroup>
      <h:outputText value="MyDropdown" style="padding-right:10px;"/>
      <h:selectOneMenu id="lastSearch" binding="#

      {BBController.savedSearchesMenu}

      "/>
      </h:panelGroup>

      <h:outputText value="<br/><br/>" escape="false"/>
      <h:commandLink actionListener="#

      {BBController.doImmediate}

      " value="doImmediate" immediate="true"></h:commandLink>
      <h:outputText value="<br/><br/>" escape="false"/>
      <h:commandLink actionListener="#

      {BBController.doNormal}

      " value="doNormal"></h:commandLink>
      </h:form>
      </f:view>

      BBController snippet:
      public class BackingBean implements Serializable {
      private static final long serialVersionUID = 1L;
      private transient UISelectOne savedSearchesMenu;
      public BackingBean() {}

      public UISelectOne getSavedSearchesMenu() {
      System.out.println ("getSavedSearchesMenu called");
      if (this.savedSearchesMenu==null)

      { this.populateSavedSearchesMenu(); }

      return this.savedSearchesMenu;
      }

      public void setSavedSearchesMenu(UISelectOne savedSearchesMenu)

      { System.out.println ("*** setSavedSearchesMenu called"); this.savedSearchesMenu = savedSearchesMenu; }

      private SelectItem[] populateSavedSearchesMenu(){
      SelectItem[] selectItems = new SelectItem[5];
      for (int i=0; i<5; i++)

      { selectItems[i] = new SelectItem(i+" testItem"); }

      this.savedSearchesMenu = new HtmlSelectOneMenu();

      //add an emtpy Select Item
      UISelectItem uiItem = new UISelectItem();
      uiItem.setValue( new SelectItem(""));
      this.savedSearchesMenu.getChildren().add(0, uiItem);

      //add the saved searches
      UISelectItems uiItems = new UISelectItems();
      uiItems.setValue(selectItems);
      this.savedSearchesMenu.getChildren().add(uiItems);

      return selectItems;
      }

      /**

      • Action Listener to show detailed document profile data.
      • @param ae The ActionEvent
        */
        public void doImmediate(ActionEvent ea) { System.out.println ("doImmediate called"); // This causes the current View tree to be discarded and a fresh one created. // The new components of course then have no submitted values, // and so fetch their displayed values via their value-bindings. FacesContext context = FacesContext.getCurrentInstance(); ViewHandler viewHandler = context.getApplication().getViewHandler(); UIViewRoot viewRoot = viewHandler.createView(context, context.getViewRoot().getViewId()); context.setViewRoot(viewRoot); context.renderResponse(); }

      /**

      • Action Listener to show detailed document profile data.
      • @param ae The ActionEvent
        */
        public void doNormal(ActionEvent ea) { System.out.println ("do normal called"); }

        }

      Output after clicking the immedaite link
      with 1.1.3:

          • setSavedSearchesMenu called
            doImmediate called
            getSavedSearchesMenu called

      with 1.1.4:

          • setSavedSearchesMenu called
            doImmediate called
            getSavedSearchesMenu called
          • setSavedSearchesMenu called

      The obvious difference is the 2.nd call of the setter.
      The parameter savedSearchesMenu (of type HtmlSelectOneMenu) is not initialized anymore.
      All attributes are null or false except _valid which is true.

      URL of the discussion:
      http://marc.theaimsgroup.com/?l=myfaces-user&m=115953578324128&w=2

      Attachments

        1. ddTest.war
          3.81 MB
          Michael Heinen

        Activity

          People

            Unassigned Unassigned
            mheinen Michael Heinen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: