[ http://issues.apache.org/jira/browse/MYFACES-1430?page=all ]

Thomas Spiegl resolved MYFACES-1430.
------------------------------------

    Resolution: Fixed

Thanks for the testcase Michael!!

Patch for MyFaces-1301 broke createComponent in class ApplicationImpl.


> 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
>             Fix For: 1.1.5-SNAPSHOT
>
>         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