2 Replies Latest reply on Jun 6, 2014 5:21 AM by Niels Bech Nielsen

    Losing viewstate in only one form (or re-rendering of a form)

    Niels Bech Nielsen Newbie

      I have a problem of loosing the viewstate on ajax update.

      rich-faces 4.3.4, on mojarra 2.2.5, on tomcat 7 with java7

       

      It is likely related to the generic problem (https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-790), but I can't really put the finger on the spot. I have narrowed it down to a very explicit scenario, that just doesn't work for me.

       

      The table below opens a popup on each element, still within the form and shows the data item. Works fine. The demo has a fix model of 10 every time.

      (Originally the popup might do some modification on a bean which the table depended on, so a render of the entire form was necessary, but I have simplified it here).

      When I re-render the form using the a4j:commandbutton with execute="@this" and render="@form", I can no longer get my id's passed to the dialog.

       

      I notice on the a4j log that all requests seems to send a viewstate update back, which subsequently fails with

      richfaces.queue: ajax submit error: During update: javax.faces.ViewState not found.


      I noticed that the updated form was explicitly without the hidden viewstate parameter, and so it never gets posted back.

      I did notice the FINE: Postback: restored view for /test.jspx on all requests including the re-render, and subsequent loss of it and getting: FINE: New request: creating a view for /test.jspx.However, given that it rendered the entire model anew, wouldn't it have worked anyway?


      So, basically. After re-rendering the form, I can no longer get the a4j:param working..


      Does anybody have any clues? I have tried many, many things by now, without much help.



      <h:body>

        <h:form id="form1">

       

          <rich:dataTable value="#{demoController.model}" var="m">

            <rich:column>#{m.id}</rich:column>

            <rich:column>

              <a4j:commandLink execute="@this" render="demopopup" title="Go"

                oncomplete="#{rich:component('demopopup')}.show()">

                <a4j:param value="#{m.id}" assignTo="#{demoCommand.demoid}" />

                <h:outputText value="Open" />

              </a4j:commandLink>

            </rich:column>

       

          </rich:dataTable>

          <a4j:commandButton value="Re-render" execute="@this" render="@form"/>

       

       

          <rich:popupPanel id="demopopup" domElementAttachment="form" autosized="true"

            onmaskclick="#{rich:component('demopopup')}.hide()">

            <h:panelGrid columns="2">

              <h:outputLabel value="id" styleClass="bold" for="vid"/>

              <h:outputText id="vid" value="#{demoCommand.editedDemo.id}" />

            </h:panelGrid>

          </rich:popupPanel>

        </h:form>

       

        <a4j:log level="debug" />

       

      </h:body>

       

       

      Regards