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.
Hi, I have text area where the user can enter any ascii character. I am retrieving them through my JSP code and storing it in the Database. when i try to retrive from DB and return it as an HTML page, how do i preserve the characters so that the formatting is as entered by the user. This includes newline, spaces, ''', '""' etc... Thanks for the help in advance. Parthasarathy
ok so when you enter the data in the DB using SQL make sure you use a PreparedStatement. This will then escape any characters that might intererfere with the SQL syntax. You do not need to deal with any of the encoding and decoding of the characters through the HTTP transfer because your container will do that. If you are displaying it as text in HTML then you will need to convert newlines in to <br /> which you can do by just using the String replaceAll method or of course just use the HTML <pre> tag to wrap the whole thing. If you are displaying it in another text area you dont need to wory about that.
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.