[ 
http://issues.apache.org/jira/browse/MYFACES-1430?page=comments#action_12444040 
] 
            
Michael Heinen commented on MYFACES-1430:
-----------------------------------------

Here is another szenario where selectMenu looses values with myFaces core 1.1.4 
!!!

On page1 is a selectMenu with componentBinding.
The corresponding BackingBean has sessionScope.
On this page1 I click an outputLink to page2.
On page2 I click another outputLink back to page1.
Then the selectMenu on page1 is empty !!!!
This is also not the case with myFacesCore 1.1.3
The used version of tomahawk is again 1.1.3. 
This bug makes the whole myFaces core 1.1.4 unuseable!
I need really urgent a patch for this critical bug. 

Here are the code snippets to reproduce it:
Page1:
<html>
<head>
</head>
<body>
<f:view>
<h:form id="myform">
                <h:outputText value="Menu"/>
                <h:selectOneMenu id="savedSearchesMenu" 
binding="#{BBController.savedSearchesMenu}"/>
                
                <h:outputText value="<br/><br/>uiItems" escape="false"/>
                <h:selectOneMenu id="uiItems" value="empty">
                   <f:selectItems value="#{BBController.selectItems}"/>
                </h:selectOneMenu>

   <h:outputText value="<br/><br/>" escape="false"/>
   <h:outputLink value="/ddTest/faces/page2.jsp"><h:outputText 
value="doOutpoutLinkToPage2"/></h:outputLink>
</h:form>
</f:view>
</body>
</html>

page2:
<body>
<f:view>
<h:form id="myform">
   <h:outputLink value="/ddTest/faces/page1.jsp"><h:outputText 
value="doOutpoutLinkToPage1"/></h:outputLink>
</h:form>
</f:view>
</body>

BBController:
package com.test;
import java.io.Serializable;
import javax.faces.application.ViewHandler;
import javax.faces.component.UISelectItem;
import javax.faces.component.UISelectItems;
import javax.faces.component.UISelectOne;
import javax.faces.component.UIViewRoot;
import javax.faces.component.html.HtmlSelectOneMenu;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.model.SelectItem;

public class BackingBean
    implements Serializable
{

  private static final long serialVersionUID = 1L;
  private transient UISelectOne savedSearchesMenu;
  private SelectItem[] selectItems; 

  private String text = "MyText";
  
  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;
  }
  
  public SelectItem[] getSelectItems()
  {
    System.out.println("*** getSelectItems called");
    return this.selectItems;
  }

  public void setSelectItems(SelectItem[] l)
  {
    System.out.println("*** setSelectItems called");
    this.selectItems = l;
  }

  private SelectItem[] populateSavedSearchesMenu()
  {
    this.selectItems = new SelectItem[5];

    for (int i = 0; i < 5; i++)
    {
      this.selectItems[i] = new SelectItem(i + " testItem");
    }

    // create new UIcomponents
    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;
  }

  public String getText()
  {
    return this.text;
  } 
}

FacesConfig:
<faces-config>
        <managed-bean>
                <managed-bean-name>BBController</managed-bean-name>
                <managed-bean-class>com.test.BackingBean</managed-bean-class>
                <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
</faces-config>

> selectOneMenu looses values after clicking immediate link (since 1.1.4)
> -----------------------------------------------------------------------
>
>                 Key: MYFACES-1430
>                 URL: http://issues.apache.org/jira/browse/MYFACES-1430
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions: 1.1.4
>         Environment: myFacesCore 1.1.4
> tomahawk 1.1.3
> Tomcat 5.5.17
> jdk 1.5.0.7
>            Reporter: Michael Heinen
>            Priority: Critical
>         Attachments: ddTest.war
>
>
> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to