Details
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="#
"/>
</h:panelGroup>
<h:outputText value="<br/><br/>" escape="false"/>
<h:commandLink actionListener="#
" value="doImmediate" immediate="true"></h:commandLink>
<h:outputText value="<br/><br/>" escape="false"/>
<h:commandLink actionListener="#
" 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)
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++)
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
- setSavedSearchesMenu called
-
with 1.1.4:
-
-
- setSavedSearchesMenu called
doImmediate called
getSavedSearchesMenu called - setSavedSearchesMenu 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