6 Replies Latest reply on Aug 23, 2007 4:25 PM by Mitesh Panchal

    Getting Error: View state couldn't be restored--reload page?

    Greg Zoller Newbie

      Hello,

      I'm getting a popup with the error: View state couldn't be restored--related page? My action method is not being called. The conditional logic on on the outputPanel rendering appears to work fine.

      What I want to happen is that when this link is clicked a method performs some logic that may change the property value used to decide whether to render an outputPanel or not, then reRender the panels.

      A code snippet is shown below. Any ideas what its not happy about?

      Thanks!
      Greg

      <a4j:region>
       <div id="demo-bar">
       <a4j:commandLink
       id="link1"
       value="Global HQ"
       action="#{session.clicked('wow')}"
       immediate="true"
       reRender="foo"/>
       </div>
       <div id="demo-wrapper">
       <div id="demo-inner">
       <a4j:outputPanel layout="none" id="foo">
       <a4j:outputPanel id="panel_1" ajaxRendered="true" rendered="#{session.office=='RSM'}">
       <div id="content1" class="scrolling-content">
       <div class="addr">Stuff Here</div>
       </a4j:outputPanel>
       <!-- More a4j:outputPanel's here with conditional rendered logic -->
       </a4j:outputPanel>
       </div>
       </div>
      </a4j:region>
      


        • 1. Re: Getting Error: View state couldn't be restored--reload p
          Sergey Smirnov Master

          "View state couldn't be restored" appears when the session is expired. Of course, the action is in not invoked in this case as soon as JSF lifecycle comes the short way (1->6 phases)
          You have a very unusual usage of EL fo action. What environment do you have.
          Also, your usage of outputPanel layout="none" is incorrect. see my post at: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052203#4052203

          • 2. Re: Getting Error: View state couldn't be restored--reload p
            Greg Zoller Newbie

            Hi Sergey,

            I'm using Seam 1.2.1GA. The s: tags support parameter passing in the EL--not sure if A4J does, but thought I'd try it. I've also tried no-parameter action calls but they didn't work either for the reason you stated.

            I changed my wrapper panel 'foo' to *not* use layout=none. It's only there because I read on another post that its not good to reRender items that have rendered attributes (right?). So this is a wrapper.

            I also got rid of immediate=true on the commandLink.

            None of this changed my error--I still get the popup. I can't see how the session can be expired. I just logged into my app 1 second before I pop open this page. I can see my session in the seam debug screen. I also have a valid Seam conversation and on the debug screen I can see the conversation variable used to determine whether to render the active pieces of my display (and that part works).

            When the popup happens I get the exception shown below.

            Would using an actionListener be any different or is my problem something else?

            Thanks,
            Greg

            08:17:19,169 ERROR [ExceptionFilter] exception root cause
            java.lang.IllegalArgumentException: Stack must not be null
             at org.jboss.seam.core.ConversationEntry.<init>(ConversationEntry.java:40)
             at org.jboss.seam.core.ConversationEntries.createConversationEntry(ConversationEntries.java:50)
             at org.jboss.seam.core.Manager.createConversationEntry(Manager.java:685)
             at org.jboss.seam.core.Manager.beforeRedirect(Manager.java:834)
             at org.jboss.seam.core.Manager.beforeRedirect(Manager.java:852)
            ...more...
            


            • 3. Re: Getting Error: View state couldn't be restored--reload p
              Greg Zoller Newbie

              I did some further testing and have trimmed the code down to the essential error. All the rendered outputPanels are not relevant to the popup error. The code below is sufficient to cause the error for me.

               <form id="scroller">
               <a4j:region>
               <div id="demo-bar">
               <a4j:commandLink
               id="link1"
               value="Global HQ"
               action="#{session.clickOffice}"
               />
               </div>
               </a4j:region>
               </form>
              


              • 4. Re: Getting Error: View state couldn't be restored--reload p
                Greg Zoller Newbie

                Ok, my bad--mystery solved!

                The problem was the form declaration. I was using when I should have been using <h:form> for JSF. After I made the change things worked as expected.

                Greg

                • 5. Re: Getting Error: View state couldn't be restored--reload p
                  Gena Newbie

                  Could it be really a solution? I'm getting the same exception also with <h:form and <form jsfc="h:form" and with <tr:form (trinidad)

                  Gena

                  • 6. Re: Getting Error: View state couldn't be restored--reload p
                    Mitesh Panchal Newbie

                    I was also facing the same issue. And i found that
                    It occurs might be of
                    1) if we have any null value in the bean property and that value we are using in jsf comopnent.
                    2) if we are using a4j:keepAlive then we have to make sure that bean implements serializable and any other object we use in that bean are also serializabel

                    try with above two suggessions.

                    Thanks
                    Mitesh