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.
I enter a text like this (in the textarea) : aaaaaaa bbbbb cccccc I want to save this in the database(mysql) an then, read from db and put on the screen(webpage) exactly as i entered in the textarea (with the newlines,etc.). How can i do that? .. because when a read from db and put on the screen the text looks like this: aaaaaabbbbbbccccc...THNX!...( i don't want to use html tags( like .<br>.) when i enter the text)
This is not a servlet question, it's an HTML formatting issue. The easiest way to do it is to output the data between presentation tags <pre></pre>, or you can look at CSS and find the style settings to retain formatting. The default in HTML is to treat it all as white space and ignore it. BUT that's only if the line feeds are being retained in the database. It would be worth checking the data to make sure it's being retained correctly first. Dave.
I'm not sure they are the same problem. Relu, did this help? 'ch', your post may be better in the JDBC firum, but I can't move this thread there because of the original post. Can you post some of your code? Dave
The problem is that when you enter the text in a textarea, new lines are in fact return characters. HTML does not use the return character to display text on a new line. What I do to solve this problem is replace all '\n' characters with a string containing "<br>". This will format your text the way you want in html. I also remove all '\r' characters since you no longer need that character. Hope this helps. -Chris
Joined: Mar 18, 2004
The <pre> </pre> it's working (..for the moment)... THNX a lot! ...
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