2 Replies Latest reply on Oct 17, 2007 6:12 PM by cbrautigam

    problem with a4j:poll (Browser caching??) Please help!

    cbrautigam

      Hi all, I'm a newbie to ajax4jsf. I'm having a problem with the poll tag. I am trying to build a page that will update a table with new data every 10 seconds. In the poll tag I'm calling a method on the managed bean that updates the datamodel for the datatable that I'm trying to update. I've noticed that if I use the Konqueror web browser, my page works just as I want...Every 10 seconds my managed bean method gets called and my table is updating just as I would expect.

      If I use IE 6 or firefox 1.5, my managed bean method only gets called once, and then never again. I tried popping a javascript alert on the on Submit of the a4j:poll tag and I see that every 10 seconds my alert is getting called in both IE and firefox, but not request is getting submitted to the server.

      So that makes me think the browser is caching and not actually submitting the request to the server.... But again the same page works fine in Konqueror.

      In the past with other ajax issues I've put a hidden property in the form, and tried updating it with the current date before each request goes out to the server, to fool the browser into thinking its a new request each time....but that strategy hasn't worked for this poll tag issue I'm having.

      I looked through and tried most all of the attributes of the a4j:poll tag and nothing seems to work.

      Does this seem a like a browser caching problem? Is there some flag or attribute to alleviate this either in the a4j:poll tag or in the config for ajax4jsf? I really need to get this working soon, and help would be greatly appreciated.

      Thanks!

        • 1. Re: problem with a4j:poll (Browser caching??) Please help!

          Please post a code snippet and the versions of your current configuration.

          First guess: if you use old versions, it could be a bug that is now fixed.

          • 2. Re: problem with a4j:poll (Browser caching??) Please help!
            cbrautigam

            FYI, I'm using ajax4jsf 1.1.1.
            I did get partial success, but now I'm broke again. I had success when I added the id attribute on the a4j:poll tag. (i.e <a4j:poll id="poll")
            So the following snippet seems to work, although that was just pure luck that I stumbled on to that....That seems pretty flaky to me, especially when the docs say that the id tag is optional:

            <h:form id="tableForm">
            <t:dataTable id="formTable" value="#{tableBean.rowDataModel}" var="row">

            <t:columns value="#{tableBean.columnDataModel}" var="dataDesc">
            <f:facet name="header">
            <h:outputText value="#{dataDesc.displayName}"/>
            </f:facet>
            <h:outputText value="#{tableBean.columnValue}"/>
            </t:columns>
            </t:dataTable>

            <a4j:poll id="poll" interval="10000" enabled="true" reRender="formTable"
            action="#{tableBean.getData}"/>
            </h:form>


            Now I'm broke again because I had to put some check boxes on my data table: The following code doesn't work...You'll notice the only difference is the addition of the <t:column>....</t:column>. Having this in there the polling doesn't work again. No errors, no exceptions, just doesn't work. I also tried putting the a4j:poll tag in its own form and surrounding it with an a4j:region tag as was suggested on the online docs, but that doesn't help either.

            <h:form id="tableForm">
            <t:dataTable id="formTable" value="#{tableBean.rowDataModel}" var="row">
            <t:column>
            <f:facet name="header">
            <h:outputText value="Select"/>

            <h:selectManyCheckbox value="#{tableBean.selectedRows}">
            <f:selectItem value="#{tableBean.selectItem}"/>
            </h:selectManyCheckBox>
            </t:column>
            <t:columns value="#{tableBean.columnDataModel}" var="dataDesc">
            <f:facet name="header">
            <h:outputText value="#{dataDesc.displayName}"/>
            </f:facet>
            <h:outputText value="#{tableBean.columnValue}"/>
            </t:columns>
            </t:dataTable>

            <a4j:poll id="poll" interval="10000" enabled="true" reRender="formTable"
            action="#{tableBean.getData}"/>
            </h:form>



            Should I not be using Ajax4JSF1.1.1?