wood burning stoves*
The moose likes JSP and the fly likes How preserve formatting while getting some text from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How preserve formatting while getting some text from database" Watch "How preserve formatting while getting some text from database" New topic
Author

How preserve formatting while getting some text from database

Shruti Sagar Mohanta
Greenhorn

Joined: Nov 22, 2012
Posts: 3
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

Joined: Jan 08, 2009
Posts: 1479
    
    6

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.


Swastik
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1027
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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How preserve formatting while getting some text from database