Have not tried it but you could maybe use a custom converter like the one bellow(Converts \n to
)
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import org.apache.commons.lang.StringUtils;
public class BreakLineConverter implements Converter {
/**
* No conversion required
*/
public Object getAsObject(FacesContext context, UIComponent component, String value) {
return value;
}
/**
* Converts All \r \n \r\n into break
*/
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (null==value || StringUtils.isEmpty((String)value))
return "";
String val=value.toString();
//This will take care of Windows and *nix based line separators
return val.replaceAll("\r\n", "<br />").replaceAll("\r", "<br />").replaceAll("\n", "<br />");
}
}
Register converter in faces-config.xml
<converter>
<description>Converts data to be displayed in web format
</description>
<converter-id>BreakLineConverter</converter-id>
<converter-class>comp.web.converter.BreakLineConverter</converter-class>
</converter>