5 Replies Latest reply on Apr 30, 2008 4:26 AM by ff fff

    org.ajax4jsf.xmlparser confusion / problem - pls help

    ff fff Newbie

      Hi,

      fist of all i have a very very simple problem:
      i want the content of my facelets page to be outputtet to the browser with no correction.The background is that i want to generate json javascript code on a facelets page.

      It all was working until i upgrade to richfaces (from ajax4jsf-1.1.1).
      After upgrading i noticed richfaces puts an

      </html>
      at the end of fileTo reproduce this just make an empty page:

      performance.xhtml in directory pages:
      <ui:component xmlns:ui="http://java.sun.com/jsf/facelets">
      </ui:component>
      


      that leads to the output:
      </html>
      


      With ajax4jsf 1.1.1 this dont happened so its a richfaces thing.

      So after reading documentation , i wanted to turn of correction for that particular page performance.xhtml

       <context-param>
       <param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
       <param-value>NONE,NEKO,TIDY</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.ajax4jsf.xmlparser.NONE</param-name>
       <param-value>performance.xhtml</param-value>
       </context-param>
      


      But this has absolutly no effect.
      What am i doing wrong?

      Pls help.
      Thx very much,

      Holger


        • 1. Re: org.ajax4jsf.xmlparser confusion / problem - pls help
          Ilya Shaikovsky Master

          what about something like:

           <context-param>
           <param-name>org.ajax4jsf.xmlparser.NONE</param-name>
           <param-value>/pages/performance.xhtml</param-value>
           </context-param>
          


          • 2. Re: org.ajax4jsf.xmlparser confusion / problem - pls help
            ff fff Newbie

            well i tried every imaginable combination of url patterns - your suggestion included.

            As it seem this whole context-param org.ajax4jsf.xmlparser stuff just has no effect at all(this empty page example should be able to reproduce very easy).Why does the user manual describes a possebility when its not implemtend / working? Can anyone confirm to this ?

            I am using lates version of richfaces: "richfaces-api-3.2.0.SR1.jar"

            Can an ajax4jsf developer tell sth about this if this implemented and should take effect or if its just a dummy thing that will work maybe in future?

            I just want to turn of code correction for a page or for all - would be ok for me.


            Thx,
            Holger


            • 3. Re: org.ajax4jsf.xmlparser confusion / problem - pls help
              ff fff Newbie

              well i removed the richfaces filter form my web.xml and the code correction doesnt take effect anymore.

              So its 100% a richfaces filter thing(that would explain why an older version of ajax4jsf dont show that behavior).

              -----
              Code Correction is evil >:->
              -----

              As long as you only output html this behaviour is ok or necessary - but not if u want to output javascript or xml, there code correctino leads to mess.

              Hope u help me fix it - in my opinion its a richfaces bug.

              Bye,
              Holger

              • 4. Re: org.ajax4jsf.xmlparser confusion / problem - pls help
                Alexander Smirnov Master

                RichFaces filter perform corrections for an html responses only. It should be called on content types "text/html" and "application/xml+xhtml" only. With facelets, you can set properly content type as :

                <f:view contentType="text/javascript" xmlns:f= .... >
                <ui:component xmlns:ui="http://java.sun.com/jsf/facelets">
                </ui:component>
                </f:view>
                


                • 5. Re: org.ajax4jsf.xmlparser confusion / problem - pls help
                  ff fff Newbie

                  Hello, first of all i get it working with a modification of your code

                  <f:view contentType="text/javascript" xmlns:f="http://java.sun.com/jsf/core">
                  ... generate javascript or whatever here
                  </f:view>


                  Setting the proper content type is always a good thing.
                  Now the filter wont parse course of non html content - like u wrote.


                  So but what i dont understand is that i couldnt just turn off parser for html content as described in the user manual - like this

                  <context-param>
                   <param-name>org.ajax4jsf.xmlparser.NONE</param-name>
                   <param-value>/pages/performance.xhtml</param-value>
                   </context-param>


                  Anyway thx very much for solution- i can live with it :-)