You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Erickson <de...@cmcflex.com> on 2003/12/18 01:05:28 UTC

Best way to parse a String and replace line feeds with
for html?

Situation:
using the html:textarea element tag to enter notes on an object, thats
getting persisted as a blob in our database.  I would like to be able to
output this to html with the same formatting.. ie the line feeds work.
Whats the best way to do this?  I tried the jstl:core c:out tag and it didnt
work (did not goto the next line), tried the struts bean:write tag same
problem.  Is there another struts tag library I can use?
Thanks,
David


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Best way to parse a String and replace line feeds with
for html?

Posted by Brice Ruth <br...@fiskars.com>.
You'll either need to write a custom taglib, or use a scriptlet as follows:

<% myString = myString.replaceAll("\n","<br>"); %>

David Erickson wrote:

>Situation:
>using the html:textarea element tag to enter notes on an object, thats
>getting persisted as a blob in our database.  I would like to be able to
>output this to html with the same formatting.. ie the line feeds work.
>Whats the best way to do this?  I tried the jstl:core c:out tag and it didnt
>work (did not goto the next line), tried the struts bean:write tag same
>problem.  Is there another struts tag library I can use?
>Thanks,
>David
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>  
>

-- 
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org