- 
        1. Re: Ajax response not preserving line breaksamarkhel Sep 27, 2010 8:17 AM (in response to hattifnat)1 of 1 people found this helpfulCould you paste your code? Btw, is this problem related to particular browsers or all? Do you try set default parser to NEKO or NONE? 
- 
        2. Re: Ajax response not preserving line breakshattifnat Sep 27, 2010 2:13 PM (in response to amarkhel)I'll try to produce a simple example from my real code asap. I checked the problem exists on Firefox 3.6 and Chrome 6.0, I'll confirm Safari, Opera and IE tomorrow. Why I think the problem is on the server side is that using Firebug I can see the incoming response XML and it doesn't contain any line breaks. I didn't realize it is possible to configure different parsers. I'll try that and post the results. Thanks for the hints! 
- 
        3. Re: Ajax response not preserving line breakshattifnat Sep 28, 2010 4:45 AM (in response to hattifnat)Here's an example: test.xhtml<?xml version='1.0' encoding='UTF-8' ?> 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:f="http://java.sun.com/jsf/core"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:c="http://java.sun.com/jstl/core"
 xmlns:ui="http://java.sun.com/jsf/facelets"
 xmlns:a4j="http://richfaces.org/a4j">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title></title>
 </head>
 <body>
 <h:form id="testForm">
 <div>
 <h:outputText value="#{testBean.text}" style="white-space: pre;"/>
 </div>
 <a4j:commandButton value="RELOAD" action="#{testBean.reload}" reRender="testForm"/>
 </h:form>
 </body>
 </html>TestBean.javapackage test; import org.ajax4jsf.model.KeepAlive; @KeepAlive 
 public class TestBean {private static final String TEXT = "Line one\r\nLine two\r\nLine three\r\nLine four"; // Using \n only makes no difference public String getText() { 
 return TEXT;
 }public void reload() { 
 // empty
 }
 }faces-config.xml<managed-bean> 
 <managed-bean-name>testBean</managed-bean-name>
 <managed-bean-class>test.TestBean</managed-bean-class>
 <managed-bean-scope>request</managed-bean-scope>
 </managed-bean>ResultOn initial page load, the output is: Line one Line two Line three Line four After reRender, it's: Line one Line two Line three Line four The initial HTTP response contains line breaks. The later AJAX response contains no line breaks. Confirmed on FF 3.6, IE 8, IE 8 as IE 7, Opera 10.61, Chrome 6.0, Safari 5.0. I'll try different parsers now. 
- 
        4. Re: Ajax response not preserving line breakshattifnat Sep 28, 2010 5:31 AM (in response to hattifnat)OK, I switched to NEKO (had to add two dependencies: nekohtml and xercesImpl - marked as optional in richfaces-impl pom.xml) and it works fine. I'm still not sure whether the default TIDY parser should expunge the line breaks - can anyone confirm? 
 
    