a4j:jsFunction error with Netscape and Safari ('//]]>' CDATA
georgemic Sep 29, 2008 9:57 AMI 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