11 Replies Latest reply on Apr 26, 2007 5:30 AM by scottstevenson

    <a4j:page>  Required or not?


      I recently upgraded to MyFaces 1.1.5 / Tomahawk 1.1.5 and removed the <a4j:page> tags from my application as I understand that this is deprecated.

      All seems to work ok apart from my custom Ajax components (I have a custom Ajax datascroller and a custom Ajax sort header). If I remove the <a4j:page> tags then these no longer rerender as they should.

      The log WITHOUT the <a4j:page> tag looks like:

      debug[13:04:50,729]: Header Ajax-Update-Ids not found, search in <meta>
      debug[13:04:50,745]: search for elements by name 'meta' in element #document
      debug[13:04:50,745]: selectNodes found 2
      debug[13:04:50,760]: Find <meta name='Ajax-Update-Ids' content=''>
      warn[13:04:50,776]: No information in response about elements to replace
      debug[13:04:50,776]: call selectSingleNode for id= ajax-update-ids
      debug[13:04:50,792]: Hidden JSF state fields:
      debug[13:04:50,792]: search for elements by name 'input' in element span

      The log WITH the <a4j:page> tag looks like:

      debug[13:06:00,152]: Update page by list of rendered areas from response reportBuilderForm:LookupView:lookupListTab:lookupListTabView:lookupDatatable
      debug[13:06:00,167]: search for elements by name 'script' in element #document
      debug[13:06:00,167]: selectNodes found 4
      debug[13:06:00,183]: <script> in response with src=/NCCIP-Workstation/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.faces
      debug[13:06:00,199]: Such element exist in document
      debug[13:06:00,199]: <script> in response with src=/NCCIP-Workstation/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/11769804/resourceLoading.DummyResourceLoaderComponent/datatable.js
      debug[13:06:00,214]: Such element exist in document
      debug[13:06:00,214]: search for elements by name 'link' in element #document
      debug[13:06:00,230]: selectNodes found 1

      So is the <a4j:page> tage still required? If not, what do I need to do to get my components working without it?

      I would really like to remove the <a4j:page> tags as these seem to cause problems for the fastFilter.

      I'm using version 1.0.6 of Ajax4JSF.

      Thanks in advance.


        • 1. Re: <a4j:page>  Required or not?

          a4j:page is not deprecated.

          MyFaces has a specific behavior how the root element of the component tree is rendered.

          In JSF RI, the implementation invoke encodeBegin, encodeChildren and encodeEnd on the view root. MyFaces does not invoke them, but iterates though the view root children by itself.

          Ajax4jsf has a custom view Root that manage what to render in Ajax mode. However, due MyFaces specific mentioned above, this custom view root is not invoked. So, ajax response is not formed correctly. The encodeBegin, encodeChildren and encodeEnd of a4j:page is invoked by MyFaces. Ajax4jsf uses them to take situation under control.

          We add some enhancements in the Ajax4jsf 1.0.7 and 1.1 to reduce the number of cases when a4j:page is have to be used.

          • 2. Re: <a4j:page>  Required or not?

            Thanks for the reply Sergey.

            So in some cases a4j:page is still required? I didn't realise this. This causes a problem for me as a4j:page does not seem to work with the fastFilter and I really need to use the fastFilter as we are experiencing severe performance problems without it.

            Is there a way to

            a) Avoid using a4j:page
            b) Making a4j:page work with the fastFilter



            • 3. Re: <a4j:page>  Required or not?

              did you set forceparse to false ?

              • 4. Re: <a4j:page>  Required or not?

                Yes, forceparse is set to false.

                • 5. Re: <a4j:page>  Required or not?

                  It should not be a difference between no filter and filter with forceparse = false for non-ajax requests. What the problems you have with performance?

                  • 6. Re: <a4j:page>  Required or not?

                    Hi Sergey

                    The performance problems are related to the Ajax requests NOT the non-Ajax requests. Some pages are re-rendering a large number of components (there is nothing I can do about this) and performance is bad using the normal filter.

                    Fastfilter makes the performance acceptable however I'm having issues using it with a4j:page (which is the reason for the original question).

                    Is there some way to use a4j:page with fastFilter?

                    • 7. Re: <a4j:page>  Required or not?

                      You use pretty old version - 1.0.6 . So, some of the new options still not available for you. Is it so important for you to stick with 1.0.6 ?

                      • 8. Re: <a4j:page>  Required or not?

                        I could possibly upgrade but I would rather not unless it is guaranteed to fix my problem.

                        What are the options if I take 1.0.7 or 1.1.0?

                        • 9. Re: <a4j:page>  Required or not?

                          Ok, I've upgraded to Ajax4JSF 1.1.0. The problem is still there (I didn't really expect it to go away).

                          Do you have any suggestions for a workaround to this problem?

                          I need to use fastFilter with a4j:page or find some way to remove the a4j:page tags from my app.



                          • 10. Re: <a4j:page>  Required or not?

                            MyFaces does not magically start to render the root component when you upgrade a4j.

                            • 11. Re: <a4j:page>  Required or not?


                              "SergeySmirnov" wrote:
                              MyFaces does not magically start to render the root component when you upgrade a4j.

                              I am well aware of that Sergey but that's not my problem.

                              The Ajax4JSF documentation states:

                              "<a4j:page> is a deprecated component used for solving of incompatibility problems in early Ajax4jsf and MyFaces versions. The component encodes the full html page structure. "

                              Now from this thread, we discover that a4j:page is not deprecated and may, in some cases, be required.

                              It also seems probable that, if you do need to use a4j:page, that use of the fastFilter is not possible. Is this the case?

                              You implied that upgrading the version of Ajax4JSF may allow me to implement some workaround to get this working. I have now upgraded to 1.1.0. I did not automatically expect this to fix the problem.

                              I would appreciate clarification on this so I don't waste any more time trying to get fastFilter working with my application.