problem in using ' \n'

String content=request.getParameter("content");

/*

i'm retreving the contents of a textarea in a string named content. What happens is if i type a line in the textarea and press enter and keep typing by giving 2 to 3 enter key.

I'm adding these contents in to the database. The problem is ,only the first line is getting added in to the database.ie the remaining contents after the enter key pressed is not appened to the database.how should i remove the line feed.ie..how should i find '\n' and bring the contents in to a single line so that the whole content is appened to the database without the line feed */

[649 byte] By [koel78] at [2007-9-26 1:45:54]
# 1
hiu could use a bit of javascript to eliminate this problem,detect the charater on each keypress,if its a line feed u can eliminate it and keep appending tothe original stringhope it workssuri
suri_dev at 2007-6-29 2:43:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
thanks suri,can't we do server side validation for this?
koel78 at 2007-6-29 2:43:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
can you post the piece of your jsp code about the textarea please ?
zbadr at 2007-6-29 2:43:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hi,

If you want to remove \n char it is possible by using replace function in String .. but once you store in database and if you want to display it again it will come as single line..before that think by what character you want it to get replace? by space?

When a user hits Enter key .. there should not be any problem in getting next line.. using getParameter..

Regds,

Sri

sribk at 2007-6-29 2:43:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...