1 2 Previous Next 19 Replies Latest reply: Apr 25, 2012 12:36 PM by Brian Leathem Go to original post RSS
  • 15. Re: Richfaces 4.0.0 + Mojarra 2.0.3 => Ajax problems in dynamic ui:include
    maze_fr Newbie

    Thanks Parsi for your idea, but it's not quite the problem I have.

    My problem is with dynamique <ui:include> like <ui:include src="#{myBean.myPage}"/>.

    In that case, Ajax used in the included page doesn't work properly and style are not well rendered.

    For the moment, because the project is on a hurry, we don't use Ajax to dynamicaly include pages in pages : we just reload the complete page.

     

    But even in that case, we had a problem : by default, RF loads the entire page inside the current page to replace it, which is the same effect as dynamic <ui:include> because we load the content in Ajax.

    With that problem, any part of the page reloaded by Ajax returns a malformed XML error, because it does an "<update>" and not an "<eval>" (seen somewhere in that forum).

    We didn't have the time to find a solution for that problem too, so we used "faces-redirect=true" on every page, and we added this to web.xml :

    <context-param>

            <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

            <param-value>server</param-value>

    </context-param>

    It seams to fixe some Ajax rendering problems, but not all so we continue to just reload the entire page every time...

    It is heavy, but it works, so we will see later how to do properly the apps in Ajax.

  • 16. Re: Richfaces 4.0.0 + Mojarra 2.0.3 => Ajax problems in dynamic ui:include
    maze_fr Newbie

    Just for the notice, I found out that "a4j:ajax" doesn't work either in an "ui:include".

     

    I think the problem may not be the a4j library but the "ui:include" itself that "kills" the ajax.

    Any ajax action made by code called from in "ui:includ"ed code do an "update" in place of an "eval", so it breaks a4j javascripts.

     

    Maybe it would be more simple to build an "a4j:include" which implements "ui:include" and do an "eval" in place of an "update".

    If anyone knows how to do that, I think I won't be the only one in the community to thank him (or her) a lot to share a piece of code.

  • 17. Re: Richfaces 4.0.0 + Mojarra 2.0.3 => Ajax problems in dynamic ui:include
    maze_fr Newbie

    I found a way to bypass the "ui:include" problem : I use a taglib...

    So all my pieces of code that are already in their own pages, I declare them in a taglib (with parameters if I need to).

     

    Obviously, when the interpreter replace the tag by the code of the page, it doesn't use the same mecanism as "ui:include", and in that way, it works : all Ajax works normaly.

    It's good for pieces of code, but I still can't use that for a dynamic browsing of the app...

  • 18. Re: Richfaces 4.0.0 + Mojarra 2.0.3 => Ajax problems in dynamic ui:include
    Fabrice BOYER Newbie

    Hello,

     

    I'm realy a newbie in JSF2.0/Richfaces 4/Mojarra 2.1.4 but i have maybe found a workaround to use "ui:include" for dynamic browsing.

     

    Firstly, i update my version of mojarra to 2.1.4 and effectively there is no more needs to handle "javax.faces.PARTIAL_STATE_SAVING" in the web.xml. From here, i can click on my menu item and the dynamic content include via "ui:include" is render BUT .....then i need to reload the page to make ajax calls works normally (OR to click twice on buttons or links).

     

    So my solution is to create an hidden button (a4j:commandbutton for example) which will send a fake ajax request. Of course I dont click myself on this button but i simulate the click thank to "oncomplete" property.

     

    So below some snippets for trying to illustrate what i mean:

     

     

    my_main.xhtml :

     

    <ui:composition....

         ...

         <ui:insert name="menu"><ui:include src="menu.xhtml"></ui:insert>

         <ui:insert name="contenu"><ui:include src="contenu.xhtml"></ui:insert>

         ...

    </ui:compostion>

     

    menu.xhtml:

     

    <rich:panelMenuItem label="tableau" render="testtt" oncomplete="document.getElementById('my_form:fakeAjax_btn'):click();">

         <f:param name="current" value="/facelets/pages/tableau.xhtml"/>

    </rich:panelMenuItem>

     

    contenu.xhtml:

     

    <rich:panel id="testtt" .......>

         <ui:include src="#{session_MB.page_en_cours}"/>

    </rich:panel>

     

    and some included page:

     

    <h:form id="my_form">

         <a4j:commandButton style="visibility:hidden;" onclick="return true;" id="fakeAjax_btn"............. action="#{session_MB.fakeAjax}" />

         ...

         ... [content that will work after that !!!]

         ...

    </h:form>

     

     

    So when u inspect this with firebug ...u could see that 2 ajax requests are made when user click on menu item but the second "fake" request is very light (less than 20ms).

     

    Sorry for my "bad" english btw.....n hope this will help.

     

    Oro


     


  • 19. Re: Richfaces 4.0.0 + Mojarra 2.0.3 => Ajax problems in dynamic ui:include
    Brian Leathem Master

    We are successfully using dynamic includes in the RichFaces kitchensink quickstart for the mobile pages.  Any initial problems we came across was caused by nesting h:form's.

1 2 Previous Next