1 Reply Latest reply on Jan 18, 2008 3:14 PM by wbossons

    How bypass Tiles View Handler when Ajax4Jsf responds

    wbossons

      Is it possible to bypass the tiles view handler when Ajax4jsf response is being sent?

      I want to refresh only the ajaxed portion of the page, but the whole page is being refreshed because it's going through the Tiles View Handler.

      I know my code works because I've used it in a sample app without tiles. Removing tiles is not a possibility.

      Please help! The environment is SUN RI 1.2, Shale Tiles, on Glassfish with Ajax4JSF 1.1.2.

      Thanks in advance,
      ..\Wendy

        • 1. Re: How bypass Tiles View Handler when Ajax4Jsf responds
          wbossons

          I'll answer my own question. I hope it helps other developers/users. The answer is yes. It is possible to use Tiles with Ajax4Jsf.

          I wrote a PhaseListener that checks to see if this is an ajax request. I have a specific scenario that I'm addressing, so I'm using a request scoped attribute that tells me when it is Ajax. Then during the render_response phase, in the beforePhase method, I call the AjaxContext to render the page.

          FacesContext context = pe.getFacesContext();
          AjaxContext ajaxcontext = AjaxContext.getCurrentInstance(context);
          //Render the response
          try {
          ajaxcontext.renderSubmittedAjaxRegion(context);

          ...................
          that does it -- renders the page, bypassing the tiles view handler. One other note: if your site is XHTML Transitional, reset the content_type in the afterPhase of render_response to text/html. Otherwise, the AjaxFilter always sets the content type to text/xml, regardless of the forceparser parameter setting. This will break any pages that do not adhere to xhtml strict.

          ..\Wendy