The above is the 2.0 version of the race condition when the view is disposed (via dispose-views when leaving a view) while the server is processing a request for the same view.
I have the link with an actionListener and href working in practice for FF, Chrome, and Opera. So far, I haven't been able to get IE to play along nicely. The onclick handler I have come across is essentially:
theInsideClick:function (e)
{
e.returnValue=false;
ice.s(e, e.target);
//YAHOO.util.stopEvent(e);
//e.preventDefault();
return false;
}
Order is important. This does not work in IE.
theInsideClick:function (e)
{
ice.s(e, e.target);
e.returnValue=false;
...
}
None of the YUI methods for stopping the defaultAction work. The only method that works reliably in any browser is to return false from the onclick handler however this is breaking the normal commandLink case with just an actionListener in IE. Clicking on the actionListener only case in my test program causes the page to navigate back to the main page of the test application.
Also, using ice.s causes the actionListener for every commandLink in the form to be called, which is expected, I think. But using ice.se causes no actionListener methods to ever be called and I don't think that is expected.
I did an experiment with adding an href to a link that has been defined with an ajax actionListener. The intent was to create a link with both an actionListener but with the ability to open the link in a different page. This works, to an extent. You CAN open the link in a new tab, and clicking on the link does cause the actionListener to be called, but an NPE is thrown in the event handling afterwards.
java.lang.NullPointerException
at org.icefaces.event.BridgeSetup.processEvent(BridgeSetup.java:98)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:102)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2040)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2016)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:298)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:242)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:104)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
java.lang.NullPointerException
at org.icefaces.event.WindowAndViewIDSetup$1.encode(WindowAndViewIDSetup.java:52)
at org.icefaces.event.UIOutputWriter.encodeBegin(UIOutputWriter.java:32)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1607)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:164)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:300)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:101)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1609)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1612)
at org.icefaces.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:147)
at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:985)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1609)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:378)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)