3 Replies Latest reply on Dec 5, 2010 8:23 PM by jovincen

    multiple a4j:include and multiple transactions

    jovincen Newbie

      Hi All,

      I'm (trying ;P) to build an AJAX heavy website and am having some difficulties with a4j:include. I'm quite new to J2EE and Seam so the answer is probably obvious :/

      Is it possible to build a single page from many a4j:include's? where each is independent of the others?

      Essentially I have a single template:

      <!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"
           <ui:composition template="layout/template.xhtml">
              <ui:define name="body">
                     <a:outputPanel ajaxRendered="true"> 
                          <a:include viewId="commonTemplate.xhtml">
                               <ui:param name="uniqueID" value="one" />
                               <ui:param name="backingBean" value="#{myFirstBean}" />
                     <a:include viewId="anotherTemplate.xhtml"></a:include>
                <br /><br />
                     <a:outputPanel ajaxRendered="true">
                          <a:include viewId="commonTemplate.xhtml">
                               <ui:param name="uniqueID" value="two" />
                               <ui:param name="backingBean" value="#{mySecondBean}" />

      Each of the nested templates features a call similar to:

           <s:conversationId />

      This backingBean beginEdit() is annotated with @Begin(nested=true).

      What I'm finding is that after each post all templates on the client are taking the conversation of the latest.

      If I edit the first bean it is part of conversation 3
      If I edit the second bean then both the first and second are part of conversation 4
      And the final edit pushes all under the conversation 5.

      Seems like the client is re-rendering the <s:conversationid /> with each of the responses.

      I have tried nesting these under a single transaction, I think it might be an issue with a4j:include.

      Am I doing something fundamentally wrong?

      Seems a shame if a4j:include doesn't support this.