5 Replies Latest reply on Oct 7, 2008 11:23 AM by Michael George

    a4j:jsFunction error with Netscape and Safari ('//]]>' CDATA

    Michael George Newbie

      I am using the jsFunction component in one of my applications and it works fine in IE and some other browsers; but, when I test it in Netscape and Safari, I receive an error. I've located the problem to a CDATA xml parsing error. To verify, I've downloaded the jsFunction example code from the demo site http://livedemo.exadel.com/richfaces-demo/richfaces/jsFunction.jsf?c=jsFunction&tab=usage. This code works fine in all browsers of my test except Netscape and Safari; I receive the following errors... Any help would be appreciated:

      NETSCAPE:

      XML Parsing Error: not well-formed
      Location: http://localhost:8080/BrowserTest/
      Line Number 18, Column 5:

      //]]>
      ----^


      SAFARI:
      This page contains the following errors:

      error on line 18 at column 8: Sequence ']]>' not allowed in content
      Below is a rendering of the page up to the first error.


      GENERATED HTML:
      <html xmlns="http://www.w3.org/1999/xhtml"><head><link href='/BrowserTest/a4j/s/3_2_2.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAFrvajdHLp8hjQAEgwDtA__.jsf' type='text/css' rel='stylesheet' class='component' /><link media='rich-extended-skinning' href='/BrowserTest/a4j/s/3_2_2.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAFrvajdHLp8hjQAEgwDtA__.jsf' type='text/css' rel='stylesheet' class='component' /><link href='/BrowserTest/a4j/s/3_2_2.GAcss/separator.xcss/DATB/eAFrvajdHLp8hjQAEgwDtA__.jsf' type='text/css' rel='stylesheet' class='component' /><script type='text/javascript' src='/BrowserTest/a4j/g/3_2_2.GAorg.ajax4jsf.javascript.AjaxScript.jsf'></script><script type='text/javascript' src='/BrowserTest/a4j/g/3_2_2.GAorg/ajax4jsf/javascript/scripts/form.js.jsf'></script><script type='text/javascript'>window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
      <script type='text/javascript' src='/BrowserTest/a4j/g/3_2_2.GAorg/richfaces/renderkit/html/scripts/skinning.js.jsf'></script></head>
      <div id="j_id0" style="font-size: 0px;"><div class="rich-separator " style="height: 1px; background-image: url(/BrowserTest/a4j/g/3_2_2.GAorg.richfaces.renderkit.html.images.SimpleSeparatorImage/DATB/eAFjYNxa6sUCAATWAXo_.jsf); null;"></div></div>
       <table width="400">
       <tbody>
       <tr>
       <td onmouseover="updateName('Alex')" onmouseout="updateName('')"> Alex</td>
       <td onmouseover="updateName('Jonh')" onmouseout="updateName('')"> Jonh</td>
       <td onmouseover="updateName('Roger')" onmouseout="updateName('')"> Roger</td>
      
       </tr>
       <tr>
       <td colspan="3"><span id="showname">Name: </span></td>
       </tr>
       </tbody>
       </table><form id="j_id3" name="j_id3" method="post" action="/BrowserTest/pages/home.jsf"><script id="j_id3:updateName" type="text/javascript">
      //<![CDATA[
       //<![CDATA[
       updateName=function(param1){A4J.AJAX.Submit('_viewRoot','j_id3',null,{'parameters':{'param1':param1,'j_id3:updateName':'j_id3:updateName'} ,'actionUrl':'/BrowserTest/pages/home.jsf'} )};
       //]]>//]]>
      </script>
      <input type="hidden" name="j_id3" value="j_id3" /><input type="hidden" name="autoScroll" value="" />
      <input type="hidden" name="j_id3:j_idcl" value="" />
      <input type="hidden" name="j_id3:_link_hidden_" value="" />
      <script type="text/javascript">
      
      //<![CDATA[
      function clear_j_id3() {
      _clearJSFFormParameters('j_id3','',['j_id3:j_idcl','j_id3:_link_hidden_']);
      }
      function clearFormHiddenParams_j_id3(){clear_j_id3();}
      function clearFormHiddenParams_j_id3(){clear_j_id3();}
      clear_j_id3();
      //]]>
      </script>
      <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id4" />
      </form><div id="j_id5" style="font-size: 0px;">
      <div class="rich-separator " style="height: 1px; background-image: url(/BrowserTest/a4j/g/3_2_2.GAorg.richfaces.renderkit.html.images.SimpleSeparatorImage/DATB/eAFjYNxa6sUCAATWAXo_.jsf); padding-top:10px;">
      </div></div></html>



      HERE'S THE SOURCE CODE:
      home.xhtml:
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      
       <rich:separator lineType="solid" height="1" />
       <table width="400">
       <tbody>
       <tr>
       <td onmouseover="updateName('Alex')" onmouseout="updateName('')" > Alex</td>
       <td onmouseover="updateName('Jonh')" onmouseout="updateName('')" > Jonh</td>
       <td onmouseover="updateName('Roger')" onmouseout="updateName('')" > Roger</td>
       </tr>
       <tr>
       <td colspan="3"><h:outputText id="showname" value="Name: #{userBean.name}" /></td>
       </tr>
       </tbody>
       </table>
      
       <a4j:form>
       <a4j:jsFunction id="updateName" name="updateName" reRender="showname">
       <a4j:actionparam name="param1" assignTo="#{userBean.name}" />
       </a4j:jsFunction>
       </a4j:form>
      
       <rich:separator height="1" style="padding-top:10px" />
      </ui:composition>


      UserBean.java:
      package com.propbvi.web.view;
      
      public class UserBean {
       private String name;
      
       /**
       * @return the name
       */
       public String getName() {
       return name;
       }
      
       /**
       * @param name the name to set
       */
       public void setName(String name) {
       this.name = name;
       }
      
      }


      IMPLEMNTATIONS/VERSIONS:
      Richfaces Implementation:
      Richfaces 3.2.2GA

      Error with Browser Versions:
      Netscape Navigator 9.0.0.6
      Safari 3.1.2

      Works with Browsers:
      IE7
      Opera 9.52
      Mozilla Firefox 3.0.2


      Thanks.
      - Mike

        • 1. Re: a4j:jsFunction error with Netscape and Safari ('//]]>' C
          Mikhail Vitenkov Newbie

          georgemic, I used your page code & java bean code.
          Testing was perfomed under Safari 3.1(525.13) & Netscape Navigator 9.0.0.6.

          Richfaces 3.3.0-SNAPSHOT

          There is my page source:

          <html xmlns="http://www.w3.org/1999/xhtml"><head><link class='component' rel='stylesheet' type='text/css' href='/facelets/a4j/s/3_3_0-SNAPSHOTcss/separator.xcss/DATB/eAEL9XuiGrp8hjQAD3cDXA__.jsf' /><script type='text/javascript' src='/facelets/a4j/g/3_3_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.jsf'></script><script type='text/javascript' src='/facelets/a4j/g/3_3_0-SNAPSHOTorg/ajax4jsf/javascript/scripts/form.js.jsf'></script></head><div id="j_id0" style="font-size: 0px;"><div class="rich-separator " style="height: 1px; background-image: url(/facelets/a4j/g/3_3_0-SNAPSHOTorg.richfaces.renderkit.html.images.SimpleSeparatorImage/DATB/eAFjYJzSwcACAAP3ASI_.jsf); null;"></div></div>
           <table width="400">
           <tbody>
           <tr>
           <td onmouseover="updateName('Alex')" onmouseout="updateName('')">
           Alex</td>
           <td onmouseover="updateName('Jonh')" onmouseout="updateName('')">
           Jonh</td>
           <td onmouseover="updateName('Roger')" onmouseout="updateName('')">
           Roger</td>
           </tr>
           <tr>
           <td colspan="3"><span id="showname">Name: </span></td>
           </tr>
           </tbody>
           </table><form id="j_id3" name="j_id3" method="post" action="/facelets/CustomizePage/CustomizePage.jsf"><script id="j_id3:updateName" type="text/javascript">
          //<![CDATA[
          
           updateName=function(param1){A4J.AJAX.Submit('_viewRoot','j_id3',null,{'parameters':{'param1':param1,'j_id3:updateName':'j_id3:updateName'} ,'actionUrl':'/facelets/CustomizePage/CustomizePage.jsf'} )};
          
          //]]>
          </script><input type="hidden" name="j_id3" value="j_id3" /><input type="hidden" name="autoScroll" value="" /><input type="hidden" name="j_id3:_link_hidden_" value="" /><input type="hidden" name="j_id3:j_idcl" value="" /><script type="text/javascript">
          //<![CDATA[
          function clear_j_id3() {
          _clearJSFFormParameters('j_id3','',['j_id3:_link_hidden_','j_id3:j_idcl']);
          }
          function clearFormHiddenParams_j_id3(){clear_j_id3();}
          function clearFormHiddenParams_j_id3(){clear_j_id3();}
          clear_j_id3();
          //]]>
          </script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="H4sIAAAAAAAAAJVWTWwbRRQeO3FiO0jNjxQFqRFpElU0mHX+2ySNiJM0jVsnjWIrglYimexO7A3r3WF31t6koqSVAAkOFPEjKgVRFY7tqUcuoEogIRVEJC4cqooLIPEjISR+DsD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53YDfSx9ZNs6LE8R+/qUOUqvbOz9MNP7ZfP2nUTIOUiczRtyrDK2BN2pAgZmF1iCmcsTLNusOZcbsgs2jpoK5UTldwlVoxuXXr46b9vBblYiyPmSnz0yuvp3y/unObOUfvHeIPHUMwhn/OSlALH+s5dvyVfCzLTzO3xYg9oZWU52tF12TSQPkmbpsAuq5e8PaTUrjG2iufA7P7c6Jjo748NjHTwQI13+p/f6b0amS+TXuo0epsMu0axU6k1vFLr2HKEp5bn07J5w1ZxH8q0++wdkDKDwx7K2HQfYMvzXp8fr7hf2R3uITr2NB2/oZpECRT3s2WLulbe3LXhstEHZavbA/dFHqhEPtzL8DZyvKPuk4J43xfeEFR5pBiC93FiR8W/95JDv1N8wIcO0R92QT7ZzyA3lCDzB1A54YMuUN646lg3y/dhu/7Zz2k+ThS7QePB6uksOHOgehqJDQ910CtUzqoZbbxzbzFRl6yqNKuyXZFGm2Vt2FOXu3l3GNoFKq/e5z1X69oj6rT5sNV56qRPdQ6xZdHNGBti5fvGc8lQbmMoSbTTP000PNrXy4PIXcP/AwyFrY+bDAAA" /></form><div id="j_id5" style="font-size: 0px;"><div class="rich-separator " style="height: 1px; background-image: url(/facelets/a4j/g/3_3_0-SNAPSHOTorg.richfaces.renderkit.html.images.SimpleSeparatorImage/DATB/eAFjYJzSwcACAAP3ASI_.jsf); padding-top:10px;"></div></div></html>


          There is no such issue, as you describe, therefore try to migrate your project to latest richfaces snapshot and if the problem will be reproducible - let us know.

          Thanks for the participation,
          QC Department.

          • 2. Re: a4j:jsFunction error with Netscape and Safari ('//]]>' C
            Michael George Newbie

            Hopefully I got the snapshot from the right place (http://snapshots.jboss.org/maven2/org/richfaces/ui/richfaces-ui/3.3.0-SNAPSHOT/richfaces-ui-3.3.0-20080930.064001-21.jar). Assuming it's the right jar file, the changes you suggested does not resolve the issue I reported. Without changing the code, I receive a stack trace (see below) in all browsers I previously mentioned (including IE, Opera and Mozilla). I narrowed it down to the <a4j:form> tag. I removed that tag and the page rendered in IE, Firefox and Opera, but not in Safari and Netscape.

            I receive the same error as before in Richfaces 3.2.2GA. Let me know if I pulled the wrong jar, and where to get the right jar. I would be glad to re-test and verify what you are seeing on your end. Thanks again mvitenkov.

            type Exception report

            message

            description The server encountered an internal error () that prevented it from fulfilling this request.

            exception

            org.apache.jasper.JasperException: Servlet execution threw an exception
            org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

            root cause

            javax.servlet.ServletException: Servlet execution threw an exception
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:703)
            org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:670)
            org.apache.jsp.index_jsp._jspService(index_jsp.java:48)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

            root cause

            java.lang.NoSuchMethodError: org.ajax4jsf.javascript.ScriptUtils.getValidJavascriptName(Ljava/lang/String;)Ljava/lang/String;
            org.ajax4jsf.renderkit.html.AjaxFormRenderer.getClearHiddenCommandFormParamsFunctionName(AjaxFormRenderer.java:338)
            org.ajax4jsf.renderkit.html.AjaxFormRenderer.renderClearHiddenCommandFormParamsFunction(AjaxFormRenderer.java:270)
            org.ajax4jsf.renderkit.html.AjaxFormRenderer.doEncodeEnd(AjaxFormRenderer.java:194)
            org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
            javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:829)
            javax.faces.component.UIComponent.encodeAll(UIComponent.java:894)
            javax.faces.component.UIComponent.encodeAll(UIComponent.java:890)
            com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:578)
            org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
            org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
            com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:134)
            com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248)
            com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
            org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:703)
            org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:670)
            org.apache.jsp.index_jsp._jspService(index_jsp.java:48)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


            • 3. Re: a4j:jsFunction error with Netscape and Safari ('//]]>' C
              Michael George Newbie

              mvitenkov, if you have it working on your end with the Richfaces 3.3.0 SNAPSHOT, please send me your war file with source included. I still don't have it working correctly. Maybe it's how I am constructing the app. I am using facelets and tried switching from to <ui:composition> tags and it still didn't work in netscape and safari. When I get rid of the <a4j:form> tag it works in IE, Firefox and Opera, but not in Netscape and Safari. Any further help would be much appreciated. Thanks.

              Manifest-Version: 1.0
              Ant-Version: Apache Ant 1.6.5
              Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
              Implementation-Version: 1.1.11


              • 4. Re: a4j:jsFunction error with Netscape and Safari ('//]]>' C
                Michael George Newbie

                Ok so I am still struggling with this issue... here's what I have found so far. I realized that I had an old version of jsf-facelets.jar (v1.1.11) so I downloaded the latest version (v1.1.14). That STILL did not fix the issue. But the weird thing is, when I took the rendered code and put it in an html file, called it directly from Safari, it worked (but as a static page). Why would this not work as a dynamically rendered page but it does as a static page? What am I missing? What am I doing wrong?

                Sincerely,
                Desperate for an answer.

                • 5. Re: a4j:jsFunction error with Netscape and Safari ('//]]>' C
                  Michael George Newbie

                  Still desperate for an answer. What am I doing wrong? Anyone else out there getting this issue?