Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

formatting text output from database

 
tom mcmorrow
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
not sure if this is the right place to ask this question but it seems as good as any other.
I am trying to fromatt text output to html from a mysql data base - the input was with a textarea - would like to maintain the same fromat as the imputted text however not working for me. Anyone know where i could get some information on approaches to this problem
thnking you for you help
tom mcmorrow
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does the mysql database retain the formatting?
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is that you are not specifying the textarea quite right. By default, a textarea ignores end-of-lines. Try adding "wrap='hard'" to yor textarea tag.
 
tom mcmorrow
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
thanks for your swift replies Cindy and Frank
i don't know much about this particular subject and was hoping maybe someone could point me in the direction of some material on it. My experience of working with databases is very limited.
tom
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I am back to my question.
Did you save the text in the TextArea or the object which is a TextArea or what?
Or are you really just worried about end-of lines ?
[ August 23, 2002: Message edited by: Cindy Glass ]
 
tom mcmorrow
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks again cindy for you patient interest
My text is inputted to a textArea it is then submitted as part of a form to a servlet which saves the imput to a mysql database. The data is again retrieved on demand from the database by an servlet and outputted to a html page. I would like to maintain the output in the same format as
the text was imputted.
tom
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to explain what you mean by "in the same format". When text is input into a TextArea it is usually represented on the screen by some LayoutManager. Change the window size - the "format" changes to accomodate that.
What formatting is NOT being saved?
Do you really mean that you just want to insure that any New Line or Carriage Returns are preserved, like Frank thought?
Are you trying to retain the FONT of the input?
Is this really a JAVA or JSP TextArea, or are you talking about an HTML (JavaScript) TextArea?
[ August 23, 2002: Message edited by: Cindy Glass ]
 
tom mcmorrow
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
primarly i am trying to retain the tab spaces at the beginning of the lines. Hence the first word stands out as it is not indented the other lines are. i have used a JText area for input. Franks idea works in part for me i will try a little more experiment on it and come back in a while
tom
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic