aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 1400
    
    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: 1016
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
 
Similar Threads
How to save a text file content in a database
parsing plain file into html
? Throw an exception vs other approach
Saving and retrieving formatted data from database
How to draw a chart with multiple y-axises