2 Replies Latest reply on Oct 7, 2008 8:18 AM by toby.tobias.hill.gmail.com

    Page fragment caching (<s:cache>) html-encodes

    toby.tobias.hill.gmail.com

      Just a weird finding,


      <s:cache> html-encodes its contents. If you are having an EL-expression within that cached fragment that results in an output like "G&aring;tfull" ... (i.e. pre-encoded text) after wrapping the fragment with <s:cache> it will all of a sudden be outputed as "G&amp;aring;tfull". This of course looks completely different on screen.


      Nuisance.

        • 1. Re: Page fragment caching (<s:cache>) html-encodes
          pmuir

          Please post an issue in JIRA

          • 2. Re: Page fragment caching (<s:cache>) html-encodes
            toby.tobias.hill.gmail.com

            I investigated this further ... and it is not the s:cache tag in particular that is the problem. It seems that there is some automatic html-encoding which kicks in whenever there are tags nearby the outputted text (or in the same fragment or define).




            For instance:

            <ui:define name="yeah">
                   Ian &amp; Mic
                   #{localPageBean.preEncodedText}
            </ui:define>
            



            results in

            Ian & Mic
            G&aring;tfullt
            





            While:

            <ui:define name="yeah">
                   Ian &amp; <b>Mic</b>
                   #{localPageBean.preEncodedText}
            </ui:define>
            



            results in

            Ian & <b>Mic</b>
            G&amp;aring;tfullt
            



            (note that the latter & gets codes as a &amp;)





            ... and finally

            <ui:define name="yeah">
                   <b>Ian</b> &amp; Mic
                   G&amp;aring;tfullt
            </ui:define>
            



            results in

            <b>Ian</b> &amp; Mic
            G&amp;aring;tfullt
            



            (note that both & gets codes as a &amp;)






            So it seems that as soon as a tag is sneaked into the 'verbatim' the htmlEncoding kicks in from that point and forward. Obviously this leads very unpredicted behaviour.


            So ... is this a facelets problem or should I still file a Jira here at seam?