1 Reply Latest reply on Apr 16, 2007 3:37 PM by sergeysmirnov

    a4j + session expired -> blank page (Firefox bug?)

    jledzion

      My env:
      Tomcat 5.5
      Facelts 1.1.12
      MyFaces Tomahawk
      JSF 1.2
      A4J 1.1.0

      I've got an application with form-based authentication (LDAP realm).
      On one page there is a form with two selects. If first select has changed second one should be rerendered so the code is:


      <h:outputText value="#{app['header.category']}"/>
       <h:selectOneMenu value="#{asset.searchAsset.category}" title="IdCategory">
       <f:selectItem itemValue="-1" itemLabel="#{app['global.noneSelected']}"/>
       <f:selectItems value="#{asset.categories}"/>
       <a4j:support event="onchange" reRender="idSubcategorySearch" />
       </h:selectOneMenu>
      
       <h:outputText value="#{app['header.stand']}"/>
       <h:selectOneMenu id="idStandSearch" value="#{asset.searchAsset.stand}" title="IdStand">
       <f:selectItem itemValue="-1" itemLabel="#{app['global.noneSelected']}"/>
       <f:selectItems value="#{asset.stands}"/>
       </h:selectOneMenu>
      
      
      Everything works fine until session expires...than when user change value of the first select blank page is shown.
      The problem exsists only in Firefox...IE and Opera works fine showing login page.
      Logs from server are:

      DEBUG 11:55:38,121 [BaseFilter(doFilter:200)]: Filter start request processing at 4/16/07 11:55 AM for uri: /assets/pages/login.jsf
      DEBUG 11:55:38,121 [BaseFilter(lookupCharacterEncoding:170)]: Incoming request has Content-Type header with character encoding UTF-8
      DEBUG 11:55:38,122 [BaseFilter(doFilter:216)]: Filter request output to XML
      DEBUG 11:55:38,122 [AjaxPhaseListener(beforePhase:119)]: Process before phase RESTORE_VIEW 1
      DEBUG 11:55:38,123 [AssetSession(getCurrentAssetSession:76)]: getting AssetSession object
      //[...] my LoginListener debug code
      DEBUG 11:55:38,130 [AjaxPhaseListener(afterPhase:72)]: Process after phase RESTORE_VIEW 1
      DEBUG 11:55:38,130 [AjaxPhaseListener(beforePhase:119)]: Process before phase RENDER_RESPONSE 6
      DEBUG 11:55:38,131 [AjaxPhaseListener(beforePhase:127)]: PhaseListener enter Before RenderView Phase with ViewId /pages/login.jsf and RenderKitId HTML_BASIC
      DEBUG 11:55:38,135 [FilterServletResponseWrapper(getWriter:226)]: Create StringWriter for buffer servlet output
      DEBUG 11:55:38,136 [RendererBase(encodeBegin:92)]: Start encoding of component _viewRoot with class org.ajax4jsf.framework.ajax.AjaxViewRoot
      DEBUG 11:55:38,144 [RendererBase(encodeEnd:117)]: Finish encoding of component _viewRoot with class org.ajax4jsf.framework.ajax.AjaxViewRoot
      DEBUG 11:55:38,145 [AjaxContext(processHeadResources:356)]: Process component tree for collect used scripts and styles
      DEBUG 11:55:38,145 [AjaxPhaseListener(afterPhase:72)]: Process after phase RENDER_RESPONSE 6
      DEBUG 11:55:38,146 [BaseXMLFilter(doXmlFilter:170)]: create HTML/XML parser for content type: application/xhtml+xml; charset=UTF-8
      DEBUG 11:55:38,147 [BaseXMLFilter(doXmlFilter:215)]: Parsing html total time 0ms
      DEBUG 11:55:38,147 [BaseFilter(doFilter:239)]: Finished request processing total time 27ms for uri: /assets/pages/login.jsf

      Does any one know how to fix it in Firefox?
      BTW:
      I've tried to use A4J.AJAX.onExpired but couldn't make it work at all:-(

      <script type="text/javascript">
       A4J.AJAX.onExpired = function(loc,expiredMsg){
       alert('custom expired');
       };
       </script>


      regards.
      j.

        • 1. Re: a4j + session expired -> blank page (Firefox bug?)

          It a known problem with FireFox+XHTML when the whole document is replaced. No problem with HTML, however.

          So, add <f:view contentType="text/html"> on your page.

          P.S. AFAIK, Facelets does not require to have f:view on the page. So, setting contentType might be one of the reason when this tag have to be used.