ajax response fails Javascript XML parser without jTidy
-------------------------------------------------------
Key: RF-4987
URL:
https://jira.jboss.org/jira/browse/RF-4987
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.2.1
Environment: win XP/Linux, jboss 4.2.2 GA + JDK 1.5u11
Reporter: Gal Rubinstein
Assignee: Tsikhon Kuprevich
Priority: Minor
Fix For: 3.3.1
in web.xml we added the contex-param/init -param to remove jTidy Filer:
--fragment---
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.SERIALIZE_SERVER_STATE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.xmlparser.ORDER</param-name>
<param-value>NONE</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.xmlparser.NONE</param-name>
<param-value>.*</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.xmlfilter.forcenotrf</param-name>
<param-value>false</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
<init-param>
<param-name>enable-cache</param-name>
<param-value>true</param-value>
<init-param>
<param-name>forceparser</param-name>
<param-value>false</param-value>
</init-param>
</init-param>
</filter>
..........
--end fragment---
the JSP fragment causing this problem is apparently this (judging from from the id inside
response):
--fragment---
<rich:simpleTogglePanel switchType="ajax"
bodyClass="toggle_panel_body" styleClass="toggle_panel"
headerClass="toggle_panel_header"
id="panel_of_my_projects_list"
opened="true">
<%@ include file="simpleToggleMarkers.jsp"%>
<f:facet name="header">
<h:panelGrid
columnClasses="text_aligned_left,text_aligned_right"
styleClass="toggle_panel_header_controls" columns="2"
cellpadding="0" cellspacing="0" border="0">
<h:outputLabel styleClass="toggle_panel_header_caption"
value="#{msg.title_my_projects}"></h:outputLabel>
<h:commandLink onclick="event.cancelBubble=true;"
id="create_new_project_link"
actionListener="#{ProjectListBean.doCreateNewProject}"
value="#{msg.button_create_new_project}"
styleClass="non_toggling_panel_header_link_last_on_right_second_level"
action="projectDetailsBackground">
</h:commandLink>
</h:panelGrid>
</f:facet>
.....
-- end fragment---
a4j:log outputs:
--fragment---
error[15:58:07,101]: Error parsing XML
error[15:58:07,101]: Parse Error: XML Parsing Error: Whitespace is not allowed at this
location.
Location: Line Number 56, Column 123:
<script type="text/javascript" language="Javascript">function
dpf(f) {var adp = f.adp;if (adp != null) {for (var i = 0;i < adp.length;i++)
{f.removeChild(adp[i]);}}};function apf(f, pvp) {var adp = new Array();f.adp = adp;var ps
= pvp.split(',');for (var i = 0,ii = 0;i < ps.length;i++,ii++) {var p =
document.createElement("input");p.type = "hidden";p.name =
ps[i];p.value = ps[i + 1];f.appendChild(p);adp[ii] = p;i += 1;}};function jsfcljs(f, pvp,
t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target =
ft;dpf(f);};</script>
---------------------------------------------------------------------------------------------------------------------------^
--end fragment---
finding this fragment inside the log console we can see this:
....
--fragment---
pvp.split(',');for (var i = 0,ii = 0;i < ps.length;i++,ii++) {var p =
document.createElement("input");p.type = "hidden";p.name =
ps[i];p.value = ps[i + 1];f.appendChild(p);adp[ii] = p;i += 1;}};function jsfcljs(f, pvp,
t) {apf(f, pvp);var ft = f.target;if (t) {f.target = t;}f.submit();f.target =
ft;dpf(f);};</script>
<a id="j_id_jsp_1399388119_3:create_new_project_link" href="#"
onclick="var a=function(){event.cancelBubble=true;};var b=function(){if(typeof
jsfcljs ==
'function'){jsfcljs(document.forms['j_id_jsp_1399388119_3'],'j_id_jsp_1399388119_3:create_new_project_link,j_id_jsp_1399388119_3:create_new_project_link','');}return
false};return (a()==false) ? false : b();"
class="non_toggling_panel_header_link_last_on_right_second_level">Create a
New Project</a></td>
</tr></tbody></table>
</div><div class="dr-stglpnl-b rich-stglpanel-body toggle_panel_body"
id="j_id_jsp_1399388119_3:panel_of_my_projects_list_body" style="display :
; height: ;"><table border="0" cellpadding="0"
cellspacing="0" width="100%">
<tbody><tr class="item_inside_panel"><td><
......
--end fragment---
probably caused because there is no CDATA surrounding the javascript
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: