Hi all. I pretty new with jsp pages and am having some problems formatting text using bean:write. Our users can enter newlines in the description field, which is stored in the Db. Upon displaying this data, the newlines are ignored - they do show in the Db. I can wrap the bean in a <pre/> tag and this will show the entered newlines, but if no newlines are entered the description will show on one line. Without the <pre/> tag, the description shows neatly wrapping text (which I want), but does not show the newlines entered (which I need to show).
This shows the text neatly wrapping, but will ignore the newlines. <bean:write name="x" filter="false"/>
This will show the newlines, but also shows text on one line if no newlines are entered. <pre><bean:write name="x" filter="false"/></pre>
Is there a way to maintain the state of the description with the newlines and also not completely loose the inherent formatting?
One possible solution would be to have the action class that prepares this JSP scan the text and convert all new-line characters to "<br>". Then just display the text as you are now doing without the <pre> tag. [ May 08, 2007: Message edited by: Merrill Higginson ]