In renderResponsePhase the HtmlCalendarRenderer adds as many new commandLinks as number of days in a month to the HtmlCalendar component, and then delegates rendering to its children, but it never removes them back after completion of the rendering, which is fine with Myfaces but not if running with Myfaces + ICEFaces.
As Myfaces creates a new component tree during restoreView, so there is always a new instance of HtmlCalendar component with no existing children, while ICEFaces maintains the component tree for optimization to reduce the latency, so under ICEFaces the previously created component instance being used and it gets duplicate children in each and every renderResponsePhase. That is why rendered page shows proliferated commandLinks.
As decode() has been managed by the HtmlCalendarRenderer itself, and commandLinks never required by any other phases so it would be safe to remove them when rendering being completed. It would fix the problem with ICEFaces. The following is suggested change:
HtmlCalendarRenderer.java
public void encodeEnd(FacesContext facesContext, UIComponent component)
throws IOException
{
.....
......
//As inputCalendar component does not have any other child except the one created during renderResponsePhase
//So it is safe to make the following call
component.getChildren().removeAll(component.getChildren());
}
The above change has been tested with Myfaces and Myfaces + ICEFaces and everything works fine.
In renderResponsePhase the HtmlCalendarRenderer adds as many new commandLinks as number of days in a month to the HtmlCalendar component, and then delegates rendering to its children, but it never removes them back after completion of the rendering, which is fine with Myfaces but not if running with Myfaces + ICEFaces.
As Myfaces creates a new component tree during restoreView, so there is always a new instance of HtmlCalendar component with no existing children, while ICEFaces maintains the component tree for optimization to reduce the latency, so under ICEFaces the previously created component instance being used and it gets duplicate children in each and every renderResponsePhase. That is why rendered page shows proliferated commandLinks.
As decode() has been managed by the HtmlCalendarRenderer itself, and commandLinks never required by any other phases so it would be safe to remove them when rendering being completed. It would fix the problem with ICEFaces. The following is suggested change:
HtmlCalendarRenderer.java
public void encodeEnd(FacesContext facesContext, UIComponent component)
{ ..... ...... //As inputCalendar component does not have any other child except the one created during renderResponsePhase //So it is safe to make the following call component.getChildren().removeAll(component.getChildren()); }throws IOException
The above change has been tested with Myfaces and Myfaces + ICEFaces and everything works fine.