If you choose to keep the replaceall, then use:
<c:out value="${data}" escapeXml="false"/>

Or, for a jsp only solution:

<% pageContext.setAttribute("linefeed", "\n"); %>

<c:out value="${fn:replace(data,linefeed, '<br>')}" escapeXml="false"/>

Daniel.



> -----Original Message-----
> From: Tom Holmes Jr. [mailto:[EMAIL PROTECTED]
> Sent: 06 September 2004 17:08
> To: Struts Users Mailing List
> Subject: Line Breaks and Formatting Text
> 
> 
> I am a Struts newbie, but not in writing web-applications or JSP pages.
> 
> I am writing a simple app that is taking data from my database and 
> displaying the data in my JSP page, that works.  I got the date 
> formatted how I want, and that's fine.  The text data that I want to 
> display has some linefeeds in it within the database.  Such as:
> 
> Hi!
> This is a Test!
> This is another line!
> 
> When this displays, it displays as one long line because I know HTML 
> doesn't recognize line feeds.  So, within my DTO class, when I get my 
> data, I did a replaceAll("\n","<br>") to replace the linefeeds within my 
> text.  What happens now is that I see the <br> as part of the text, and 
> the page source shows &gt;br&lt; (which is why I see the <br>).
> 
> So, my question is ... how can I keep the line breaks by adding <br/> 
> correctly?  I want to keep the formatting the same with these line 
> breaks.  Is there some <fmt> or <c> tag that I am missing or some 
> regular expression tag I could use.  I am digging into my JSTL tag books 
> for an answer.
> 
> And BTW, I did search the Jarkarta Struts documentation, and I did look 
> on the web for an answer first.  Leaving a message here was my 
> last resort.
> 
> Thanks.
> 
>                      Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to