3 Replies Latest reply on Apr 25, 2008 10:49 AM by sergeysmirnov

    Ways to Zen

    ziphyre

      Hi,

      Being a newbie to both JSF and Ajax4JSF, I've read a lot of documentation and although not everything is crystal clear yet, I've learned a lot.

      But still, I can't figure out how to update DOM while it involves complex html, not simple reRender values.

      All of the documentation I've read so far has examples for updating simple values, or reRendering available components (like dataTable etc..)

      One of the ways, I suppose, is to use <a4j:include>, but not everything is solvable with this approach, and it sometimes clusters the code.

      Suppose that, there is a div, which I want to fill with some pictures, some links, and some text. I can use a <a4j:outputPanel> and bind the value with a property in a bean. But does it update the DOM on the server? And is this feasible to try to write html in strings in java?

      I suppose there must be a way with UIComponents where I can prepare my module (the content of the div) and inject the content in the div as a response to ajax request?

      Any guidance will be most appreciated.
      Thanks..

        • 1. Re: Ways to Zen

          What are "reRender values"? There is no such term in the RichFaces

          • 2. Re: Ways to Zen
            ziphyre

             

            "SergeySmirnov" wrote:
            What are "reRender values"? There is no such term in the RichFaces


            Yep, my bad.

            I mean when applying the reRender approach, there is generally a structure like this:

            <a4j:commandLink .... reRender="testBlock" />

            ...

            <h:panelGrid id="testBlock" >
            ...
            </h:panelGrid>

            But what if, suppose, I'd like to inject a custom block of code (in this case html and js) prepared on the server side inside a div as a ajax response, what should I do?

            • 3. Re: Ways to Zen

              use a4j:outputPanel id="testBlock" layout="block" istead of DIV. It exactly generates DIV as output.