wood burning stoves 2.0*
The moose likes JDBC and the fly likes Retrieving formatted text from mysql database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Retrieving formatted text from mysql database" Watch "Retrieving formatted text from mysql database" New topic
Author

Retrieving formatted text from mysql database

Shashank Anand
Greenhorn

Joined: Oct 30, 2008
Posts: 26
Hi,

I have a column of datatype 'text' in mysql table. I insert text using a textarea in a jsp page, like:

Hi this is Shashank.
Glad to meet you.

Bye.

When I retrieve the data, it comes out like 'Hi this is Shashank. Glad to meet you. Bye.' in a single line. Will anybody please guide me how I can maintain the text format that was put into the database and display it in the same format?

Thanks in advance.
Shashank


Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Shashank,
There are two places where the formatting could be getting lost:

1) Between submitting it and storing it in the database
2) Between retrieving it and painting the page

Do you know which of the two is causing the problem. In any case, this is likely to be an HTML question rather than a database one so I'll move it to our HTML forum.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

All you said was "it comes out like...". You didn't say "When I displayed it in a text area it looked like..." so I'm guessing you didn't display it in a text area. So it would be useful to know what tool you WERE using when you displayed it.
Shashank Anand
Greenhorn

Joined: Oct 30, 2008
Posts: 26
You are right.

So far I was trying to display the records from database in a html table. Now I retrieved it in a text area, the format was perfect. So that means the formatted text itself is saved in the database. Do you have any idea if the display is not in a text area, but simply in a paragraph like how to get the formatted text?

Regards,
Shashank
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieving formatted text from mysql database
 
Similar Threads
formatting text output from database
reworking Access to mySQL
how to ignore separators??
How to easily write a text file with beautiful format
Display of contents from TextArea