6 Replies Latest reply on May 29, 2008 8:05 AM by rohanmars

    pageflow breaks ajax

    rohanmars

      JBoss 4.2.2.GA
      Seam 2.0.1.GA


      When you use an ajax call like a4j:support from a page that is in a pageflow conversation the whole page is sent and rerendered. Defeats the whole point and I think it's a bug.


      I proved this by using a simple ajax page without a pageflow and it worked correctly. Then I started a simple pageflow as a start-state testpage then when the ajax call is made a full refresh is done.


      Any ideas on how to make this work.


      Rohan

        • 1. Re: pageflow breaks ajax
          damianharvey.damianharvey.gmail.com

          Show your page code containing the a4j:support tag.


          Cheers,


          Damian.

          • 2. Re: pageflow breaks ajax
            rohanmars

            basic page is:


            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            
            <html xmlns="http://www.w3.org/1999/xhtml"
            
                  xmlns:ui="http://java.sun.com/jsf/facelets"
            
                  xmlns:f="http://java.sun.com/jsf/core"
            
                  xmlns:h="http://java.sun.com/jsf/html"
            
                  xmlns:c="http://java.sun.com/jstl/core"
            
                  xmlns:rich="http://richfaces.ajax4jsf.org/rich"
            
                  xmlns:a4j="http://richfaces.org/a4j">
            
            <head>
            
                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
            
            </head>
            
            
            <body>
            
            
                    <h:form id="IndexForm">
            
                   <h:inputText
            
                             value="#{signinAction.test}" size="35"
            
                             maxlength="50" required="true" requiredMessage="#{msgs.REQUIRED_FIELD}" label="Amount"
            
                              id="Amount">
            
                                    <a4j:support event="onkeyup" eventsQueue="amount" requestDelay="1000" reRender="myvalue"/>
            
                        </h:inputText>
            
            
                    <h:outputText id="myvalue" value="value: #{signinAction.test}----"/>
            
                    </h:form>
            
            
            </body>
            
            </html>
            
            



            then use a page flow:


            <?xml version="1.0"?>
            
            <pageflow-definition
            
                 xmlns="http://jboss.com/products/seam/pageflow"
            
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            
                xsi:schemaLocation="http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-2.0.xsd"
            
                  name="test">
            
            
               <start-state name="start">
            
                  <transition to="test"/>
            
               </start-state>
            
            
               <page name="test" view-id="/main/test.xhtml">
            
                  <redirect/>
            
                  <transition to="test"/>
            
               </page>
            
               
            
            
            </pageflow-definition>
            
            



            backed by a bean:


            @Stateful
            
            @Local(Signin.class)
            
            @Name("signinAction")
            
            @TransactionAttribute(TransactionAttributeType.SUPPORTS)
            
            @SuppressWarnings("unchecked")
            
            public class SigninAction implements Signin
            
            
                public String getTest()
            
                {
            
                    return mValue;
            
                }
            
                public void setTest(String pvalue)
            
                {
            
                    mValue = pvalue;
            
                }
            
            
                @Begin(pageflow="test", nested=true)
            
                public void testStart()
            
                {}
            
            }



            and called from another page:


            <h:commandLink action="#{signinAction.testStart}">
            
                 <h:outputText value="Test"/>
            
            </h:commandLink>




            if you drectly access the page then all is okay, however if you access from pageflow then a full page refresh is done on each keyup.


            additionally, I tried with the latest 2.1 snapshot and jbpm 3.2.2 with the same effect.


            tried both client and server saving_state_method (s). also tried a4j regions and outputPanels.


            Rohan

            • 3. Re: pageflow breaks ajax
              barbacena

              Try use the limitToList=true and ajaxSingle=true at a4j:support.
              If it is a validation action you can also use bypassUpdates=false.

              • 4. Re: pageflow breaks ajax
                barbacena

                Sorry, for validation is bypassUpdates=true.

                • 5. Re: pageflow breaks ajax
                  pmuir

                  I think I've heard of this before. Please create a bug in JIRA, and attach an example we can use to reproduce.

                  • 6. Re: pageflow breaks ajax
                    rohanmars

                    FYI: Found the problem.


                    The problem was I the unamed transition in the page, like:


                    <page name="billercode" view-id="/bill/billerCode.xhtml">
                    
                          <redirect/>
                    
                          <transition to="billercode"/>
                    
                    



                    Relic from my previous app version (not sure why I put these back in seam 1.x  ...