This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 and Relational Databases
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32481
    
214

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.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19723
    
  10

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Retrieving formatted text from mysql database
 
It's not a secret anymore!