• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How preserve formatting while getting some text from database

 
Shruti Sagar Mohanta
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my problem.

I am developing a discussion forum using JSP.
The text data which is being saved in database and then retrieved is losing its original formatting.

What's the trick to preserve the format in the database and in the output.

Thanks in advance.
 
Swastik Dey
Rancher
Posts: 1625
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be you could have few more fields for the formatting part in the table. This is my thought, there might be better approaches to this too.
 
Stefan Evans
Bartender
Posts: 1780
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In an HTML page, whitespace is ignored.

If the formatting you are talking about is carriage returns/spaces then you need to either
- replace carriage returns with
tags etc
- use <pre> tags around the preformatted text

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic