Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep Text Formatting

Status
Not open for further replies.

pheos2

Technical User
Jul 22, 2003
19
GB
Is there a way to keep the formatting of text when it is pulled from a database (paragraphs etc)? If I view the source code of the page the formatting is in place. But when viewed in a browser all the line breaks are gone.

I have just moved over from using php and with that I used to use 'nl2br' to change new lines into br tags. Is there something similar with jsp?
 
When you pull the text from the db, you need to parse it appropriately before displaying it - replacing &quot;\n&quot; with &quot;<br>&quot;. Look at String.replace() or the JDK1.4 regexp package.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top