I did something similar, but simply did a c:out and used one of Jakarta's String taglib tags to do a String replace action.
Martin > -----Original Message----- > From: Brian Dame [mailto:[EMAIL PROTECTED] > Sent: donderdag 17 juli 2003 1:58 > To: 'Tag Libraries Users List' > Subject: RE: Preserving Line Breaks in <c:out> > > > Thanks Serge. Your suggestion works great with one caveat: > > I can't specify delims="\r\n" because those values are used literally. > However, this seems to work: > > <% String newline = "\r\n"; pageContext.setAttribute("newline", > newline); %> > <c:forTokens items="${foo}" delims="${newline}" var="foo"> > > > -----Original Message----- > From: Serge Knystautas [mailto:[EMAIL PROTECTED] > Sent: Wednesday, July 16, 2003 3:01 PM > To: Tag Libraries Users List > Subject: Re: Preserving Line Breaks in <c:out> > > > Brian Dame wrote: > > Does anyone have tips on preserving line breaks in <c:out>? > > > > For example, a user enters text into a textarea, which is > stored in a > > database. When I retrieve the text from the database, I'd like to > > display it formatted exactly as the user entered it. > > > > I can only think of two options: > > > > 1) Parse the text, insert <p> and <br> tags as needed, and set > > escapeXml=false on the <c:out> tag > > > > 2) Hardwrap the text and use a <pre> tag or CSS equivalent > around it. > > > > Anyone have other ideas? > > This is close to 1), but use c:forTokens delims="\r\n". In the loop, > print each element with whatever <br> you want between them. > > It's a bit more content in JSP, but then you don't have to > worry about > leaving some of the content unescaped. I usually use <pre>. > > -- > Serge Knystautas > President > Lokitech >> software . strategy . design >> http://www.lokitech.com p. > 301.656.5501 e. [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]