Right now, if a user enters text into a text box and saves that information, when it is redisplayed to them or another user the formatting is, as expected, wrong.
Newlines, spaces, etc all get jumbled into a single space as per the html standard.
For example if they type:
it comes out as:
Is there an easy way to remedy this? My first thought it to pass the text through a filter that replaces all newlines with an html break element but I feel JSF must provide some easier solution. My second thought may be to just display the text using another textArea but leave it disabled so as to only display the information, but this seems quite backwards.
You can use a rich text editing extension JSF tag, but most of those simply allow the editing and display of HTML, so you'll still be at the mercy of HTML's restrictions, just able to handle fancier formats such as boldface and italics.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Dec 17, 2010
I ended up just filtering newlines and carriage returns to <br/> and then turning off escape on the outputText. It's not perfect, but it looks pretty darn good. It accomplishes what we want - allowing the user to have paragraphs and create crude lists in the textbox.